* strlen holy war: loops. in loops it's very evil. the easy ones go away now.
[citadel.git] / citadel / modules / ldap / serv_ldap.c
index 41c57f9d9f5dc315cbc763efb587e45db56df3d7..06cf124e1d284e4aeaf89623dc8a74001e8189b1 100644 (file)
@@ -82,10 +82,13 @@ void CtdlCreateLdapRoot(void) {
 
        /* We just want the top-level dc, not the whole hierarchy */
        strcpy(topdc, config.c_ldap_base_dn);
-       for (i=0; i<strlen(topdc); ++i) {
-               if (topdc[i] == ',') topdc[i] = 0;
+       for (i=0; !IsEmptyStr(&topdc[i]); ++i) {
+               if (topdc[i] == ',') {
+                       topdc[i] = 0;
+                       break;
+               }
        }
-       for (i=0; i<strlen(topdc); ++i) {
+       for (i=0; !IsEmptyStr(&topdc[i]); ++i) {
                if (topdc[i] == '=') strcpy(topdc, &topdc[i+1]);
        }