This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: gas/app.c cleanup


I think the compiler can do a better job than we can.  :-)
Okay for mainline?

2006-03-10  Ben Elliston  <bje@au.ibm.com>

	* app.c (do_scrub_chars): Simplify string handling.

Index: app.c
===================================================================
RCS file: /cvs/src/src/gas/app.c,v
retrieving revision 1.33
diff -u -p -r1.33 app.c
--- app.c       25 Oct 2005 17:40:17 -0000      1.33
+++ app.c       10 Mar 2006 05:43:41 -0000
@@ -1335,26 +1335,9 @@ do_scrub_chars (int (*get) (char *, int)
              if (len > 0)
                {
                  PUT (ch);
-                 if (len > 8)
-                   {
-                     memcpy (to, from, len);
-                     to += len;
-                     from += len;
-                   }
-                 else
-                   {
-                     switch (len)
-                       {
-                       case 8: *to++ = *from++;
-                       case 7: *to++ = *from++;
-                       case 6: *to++ = *from++;
-                       case 5: *to++ = *from++;
-                       case 4: *to++ = *from++;
-                       case 3: *to++ = *from++;
-                       case 2: *to++ = *from++;
-                       case 1: *to++ = *from++;
-                       }
-                   }
+                 memcpy (to, from, len);
+                 to += len;
+                 from += len;
                  if (to >= toend)
                    goto tofull;
                  ch = GET ();












































































































































































































































































































Index: app.c
===================================================================
RCS file: /cvs/src/src/gas/app.c,v
retrieving revision 1.33
diff -u -p -w -r1.33 app.c
--- app.c       25 Oct 2005 17:40:17 -0000      1.33
+++ app.c       10 Mar 2006 05:42:55 -0000
@@ -1335,26 +1335,9 @@ do_scrub_chars (int (*get) (char *, int)
              if (len > 0)
                {
                  PUT (ch);
-                 if (len > 8)
-                   {
                      memcpy (to, from, len);
                      to += len;
                      from += len;
-                   }
-                 else
-                   {
-                     switch (len)
-                       {
-                       case 8: *to++ = *from++;
-                       case 7: *to++ = *from++;
-                       case 6: *to++ = *from++;
-                       case 5: *to++ = *from++;
-                       case 4: *to++ = *from++;
-                       case 3: *to++ = *from++;
-                       case 2: *to++ = *from++;
-                       case 1: *to++ = *from++;
-                       }
-                   }
                  if (to >= toend)
                    goto tofull;
                  ch = GET ();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]