Author: derrell
Date: 2005-06-08 20:30:50 +0000 (Wed, 08 Jun 2005)
New Revision: 7410

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

Log:
minor cleanup
Modified:
   branches/SAMBA_4_0/source/lib/ldb/common/ldb_explode_dn.c
   branches/SAMBA_4_0/source/lib/ldb/include/ldb_explode_dn.h


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-08 
20:00:31 UTC (rev 7409)
+++ branches/SAMBA_4_0/source/lib/ldb/common/ldb_explode_dn.c   2005-06-08 
20:30:50 UTC (rev 7410)
@@ -386,10 +386,9 @@
                                dest++;
                        }
                        src = component->attributes[i]->rdn;
-                       do {
-                               *(dest++) = *(src++);
-                       } while(*src);
-                       *dest = '\0';
+
+                        /* we are guaranteed to have enough space in dest */
+                        strcpy(dest, src);
                }
 
                ldb_debug(mem_ctx,
@@ -434,15 +433,17 @@
 
         /* copy the normalized components into the DN */
        for (i = 0; i < dn->comp_num; i++) {
+
+                /* add a separator between DN components */
                if (i != 0) {
-                       *dest = ',';
-                       dest++;
+                       *dest++ = ',';
                }
+
+                /* point to this component of the DN */
                src = dn->components[i]->component;
-               do {
-                       *(dest++) = *(src++);
-               } while(*src);
-               *dest = '\0';
+
+                /* we are guaranteed to have enough space in dest */
+                strcpy(dest, src);
        }
 
        ldb_debug(mem_ctx, LDB_DEBUG_TRACE, "dn: [%s]\n", dn->dn);

Modified: branches/SAMBA_4_0/source/lib/ldb/include/ldb_explode_dn.h
===================================================================
--- branches/SAMBA_4_0/source/lib/ldb/include/ldb_explode_dn.h  2005-06-08 
20:00:31 UTC (rev 7409)
+++ branches/SAMBA_4_0/source/lib/ldb/include/ldb_explode_dn.h  2005-06-08 
20:30:50 UTC (rev 7410)
@@ -32,7 +32,12 @@
 };
 
 struct ldb_dn {
-       char *dn;
-       int comp_num;
+       char *                      dn;
+       int                         comp_num;
        struct ldb_dn_component **  components;
 };
+
+
+extern struct ldb_dn *
+ldb_explode_dn(void *mem_ctx,
+               const char *orig_dn);

Reply via email to