[binutils-gdb] tekhex.c tidy writesym

Alan Modra amodra@sourceware.org
Sat Oct 26 00:00:44 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b3ee98cda498bb256411c5bc23cf7fb9b17f10db

commit b3ee98cda498bb256411c5bc23cf7fb9b17f10db
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Oct 24 18:14:52 2024 +1030

    tekhex.c tidy writesym
    
    Simplifies the code a little.  No functional changes.

Diff:
---
 bfd/tekhex.c | 18 +++++-------------
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/bfd/tekhex.c b/bfd/tekhex.c
index 16e8e185572..aea2ebb23df 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++;


More information about the Binutils-cvs mailing list