Author: tridge
Date: 2005-06-24 05:17:36 +0000 (Fri, 24 Jun 2005)
New Revision: 7873

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=7873

Log:
hopefully fixed build of ldb_explode_dn() on AIX 

I'd really rather see this code completely replaced, but I'll leave
that to simo (he has volunteered) :-)

Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_explode_dn.c


Changeset:
Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb_explode_dn.c
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/common/ldb_explode_dn.c   2005-06-24 
04:42:05 UTC (rev 7872)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_explode_dn.c   2005-06-24 
05:17:36 UTC (rev 7873)
@@ -35,7 +35,6 @@
  *  Author: Derrell Lipman
  */
 
-#include <ctype.h>
 #include "includes.h"
 #include "ldb/include/ldb.h"
 #include "ldb/include/ldb_private.h"
@@ -496,35 +495,18 @@
 }
 
 
-static char *
-parse_slash(char *p,
-            char *end)
+static char *parse_slash(char *p, char *end)
 {
-       switch (*(p + 1)) {
-       case ',':
-       case '=':
-       case '\n':
-       case '+':
-       case '<':
-       case '>':
-       case '#':
-       case ';':
-       case '\\':
-       case '"':
+       unsigned x;
+       if (strchr(",=\n+<>#;\\\"", p[1])) {
                memmove(p, p + 1, end - (p + 1));
                return (end - 1);
-
-       default:
-                if (isxdigit(p[1]) && isxdigit(p[2])) {
-                        int             x;
-
-                        sscanf(p + 1, "%02x", &x);
-                        *p = (char) x;
-                        memmove(p + 1, p + 3, end - (p + 3));
-                        return (end - 2);
-                } else {
-                        return NULL;
-                }
        }
+       if (sscanf(p + 1, "%02x", &x) == 1) {
+               *p = (unsigned char)x;
+               memmove(p + 1, p + 3, end - (p + 3));
+               return (end - 2);
+       }
+       return NULL;
 }
 

Reply via email to