public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: gas/app.c cleanup
@ 2006-03-10  5:45 Ben Elliston
  2006-03-10  9:52 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Elliston @ 2006-03-10  5:45 UTC (permalink / raw)
  To: binutils

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 ();

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PATCH: gas/app.c cleanup
  2006-03-10  5:45 PATCH: gas/app.c cleanup Ben Elliston
@ 2006-03-10  9:52 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2006-03-10  9:52 UTC (permalink / raw)
  To: Ben Elliston; +Cc: binutils

Hi Ben,

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

The code was a clever hack, but you are right, there is no need for this 
kind of thing.

> 2006-03-10  Ben Elliston  <bje@au.ibm.com>
> 
> 	* app.c (do_scrub_chars): Simplify string handling.
> 

Approved - please apply.

Cheers
   Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-10  9:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-10  5:45 PATCH: gas/app.c cleanup Ben Elliston
2006-03-10  9:52 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).