andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From 143517847c3e2accf9489946fae9460d9e9f45a7 Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Sun, 9 Mar 2014 22:34:52 -0700
dc8c34
Subject: [PATCH 179/225] Ticket #47734 - Change made in resolving ticket #346
dc8c34
 fails on Debian SPARC64
dc8c34
dc8c34
Description: The following change is not generic beyond x86 and
dc8c34
x86_64 architecture.  Putting the change into "#if (defined(CPU_x86)
dc8c34
|| defined(CPU_x86_64))".
dc8c34
 commit c0151f78509c35250095da6e2785842337963008
dc8c34
 Trac Ticket #346 - Slow ldapmodify operation time for large
dc8c34
                    quantities of multi-valued attribute values
dc8c34
 3) In slapi_has8thBit, instead of checking the 8th bit one byte
dc8c34
 by one byte, check 4 bytes at one time.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47734
dc8c34
dc8c34
Reviewed by rmeggins@redhat.com (Thank you, Rich!!)
dc8c34
(cherry picked from commit 1e00913312e165ead2f3a25b6d70f7839115007e)
dc8c34
(cherry picked from commit ba9248d02447dc693114961d9296ecb742a75add)
dc8c34
(cherry picked from commit 450607a75d23984da12c83e785a2e1cfbf49964d)
dc8c34
(cherry picked from commit 9760c042717fdaba5af65999629ff87fde46520d)
dc8c34
---
dc8c34
 ldap/servers/slapd/utf8compare.c | 13 ++++++++++---
dc8c34
 1 file changed, 10 insertions(+), 3 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/slapd/utf8compare.c b/ldap/servers/slapd/utf8compare.c
dc8c34
index e336ccb..d2dd83e 100644
dc8c34
--- a/ldap/servers/slapd/utf8compare.c
dc8c34
+++ b/ldap/servers/slapd/utf8compare.c
dc8c34
@@ -60,6 +60,7 @@ typedef struct sUpperLowerTbl {
dc8c34
 int
dc8c34
 slapi_has8thBit(unsigned char *s)
dc8c34
 {
dc8c34
+#if (defined(CPU_x86) || defined(CPU_x86_64))
dc8c34
 #define MY8THBITWIDTH 4 /* sizeof(PRUint32) */
dc8c34
 #define MY8THBITFILTER 0x80808080
dc8c34
     unsigned char *p, *stail, *ltail;
dc8c34
@@ -73,14 +74,20 @@ slapi_has8thBit(unsigned char *s)
dc8c34
              return 1;
dc8c34
         }
dc8c34
     }
dc8c34
-    for (; p < ltail; p++) {
dc8c34
+#undef MY8THBITWIDTH
dc8c34
+#undef MY8THBITFILTER
dc8c34
+    for (; p < ltail; p++)
dc8c34
+#else
dc8c34
+    unsigned char *p, *tail;
dc8c34
+    tail = s + strlen((char *)s); 
dc8c34
+    for (p = s; p < tail; p++)
dc8c34
+#endif
dc8c34
+    {
dc8c34
         if (0x80 & *p) {
dc8c34
              return 1;
dc8c34
         }
dc8c34
     }
dc8c34
     return 0;
dc8c34
-#undef MY8THBITWIDTH
dc8c34
-#undef MY8THBITFILTER
dc8c34
 }
dc8c34
 
dc8c34
 /*
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34