This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Re: [PATCH] Remove duplicate __strcmp_cg


On 04/30/2013 05:58 PM, OndÅej BÃlka wrote:
ping

This is ok, thanks,
Andreas

On Sun, Feb 24, 2013 at 10:30:55AM +0100, OndÅej BÃlka wrote:
Hello,
I noticed that __strcmp_cg code is duplicate of of __strcmp_gc.
This patch unifies these two cases into one.

2013-02-24  OndÅej BÃlka  <neleai@seznam.cz>

	* string/bits/string2.h (__strcmp_cg): Call __strcmp_gc.


>From 15db38ede486366d0d3a9cd31218dbd4fd6dcc21 Mon Sep 17 00:00:00 2001
From: Ondrej Bilka <neleai@seznam.cz>
Date: Sun, 24 Feb 2013 10:28:24 +0100
Subject: [PATCH] strcmp

---
  string/bits/string2.h |   25 +------------------------
  1 files changed, 1 insertions(+), 24 deletions(-)

diff --git a/string/bits/string2.h b/string/bits/string2.h
index 94f5ee9..ddd1c04 100644
--- a/string/bits/string2.h
+++ b/string/bits/string2.h
@@ -887,30 +887,7 @@ __stpcpy_small (char *__dest,
  		      }							      \
  		    __result; }))

-# define __strcmp_gc(s1, s2, l2) \
-  (__extension__ ({ const unsigned char *__s1 =				      \
-		      (const unsigned char *) (const char *) (s1);	      \
-		    register int __result =				      \
-		      __s1[0] - ((const unsigned char *)		      \
-				 (const char *) (s2))[0];		      \
-		    if (l2 > 0 && __result == 0)			      \
-		      {							      \
-			__result = (__s1[1]				      \
-				    - ((const unsigned char *)		      \
-				       (const char *) (s2))[1]);	      \
-			if (l2 > 1 && __result == 0)			      \
-			  {						      \
-			    __result =					      \
-			      (__s1[2] - ((const unsigned char *)	      \
-					  (const char *) (s2))[2]);	      \
-			    if (l2 > 2 && __result == 0)		      \
-			      __result =				      \
-				(__s1[3]				      \
-				 - ((const unsigned char *)		      \
-				    (const char *) (s2))[3]);		      \
-			  }						      \
-		      }							      \
-		    __result; }))
+# define __strcmp_gc(s1, s2, l2) (- __strcmp_cg (s2, s1, l2))
  #endif


--
1.7.4.4



--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 NÃrnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix ImendÃrffer,HRB16746 (AG NÃrnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


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