aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2024-10-24 18:14:52 +1030
committerAlan Modra <amodra@gmail.com>2024-10-26 10:28:10 +1030
commitb3ee98cda498bb256411c5bc23cf7fb9b17f10db (patch)
tree0783498dc8b0c51d284088cd325dddcf6d8cb9ed
parent6ecc44f6980c0f8c0f0934bc10412c1d7fa3c544 (diff)
downloadgdb-b3ee98cda498bb256411c5bc23cf7fb9b17f10db.zip
gdb-b3ee98cda498bb256411c5bc23cf7fb9b17f10db.tar.gz
gdb-b3ee98cda498bb256411c5bc23cf7fb9b17f10db.tar.bz2
tekhex.c tidy writesym
Simplifies the code a little. No functional changes.
-rw-r--r--bfd/tekhex.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 16e8e18..aea2ebb 100644
--- a/bfd/tekhex.c
+++ b/bfd/tekhex.c
@@ -736,22 +736,14 @@ writesym (char **dst, const char *sym)
int len = (sym ? strlen (sym) : 0);
if (len >= 16)
+ len = 16;
+ else if (len == 0)
{
- *p++ = '0';
- len = 16;
- }
- else
- {
- if (len == 0)
- {
- *p++ = '1';
- sym = "$";
- len = 1;
- }
- else
- *p++ = digs[len];
+ len = 1;
+ sym = "$";
}
+ *p++ = digs[len & 0xf];
while (len--)
*p++ = *sym++;