]> granicus.if.org Git - apache/commitdiff
nelts returned from a registry key may be zero... make it so.
authorWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 25 May 2002 20:02:16 +0000 (20:02 +0000)
committerWilliam A. Rowe Jr <wrowe@apache.org>
Sat, 25 May 2002 20:02:16 +0000 (20:02 +0000)
  [We previously would return an array of one empty element.]

PR: 9410
Submitted by: Vasiliy Gagin <vasiliy@gazooc.com>

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@95284 13f79535-47bb-0310-9956-ffa450edef68

server/mpm/winnt/registry.c

index b71831653add26a2bda74597539d4b31d709ff0b..a877e722f0902becba424c19b4001e3f2bd4dbf1 100644 (file)
@@ -266,26 +266,21 @@ apr_status_t ap_registry_get_array(apr_pool_t *p, const char *key, const char *n
                             pValue,        /* for value */
                             &nSize);   /* for size of "value" */
 
-        nSize = 1;    /* Element Count */
-        tmp = pValue;
-        while (tmp[0] || tmp[1])
-        {
-            if (!tmp[0])
-                ++nSize;
-            ++tmp;
+        nSize = 0;    /* Element Count */
+        for (tmp = pValue; *tmp; ++tmp) {
+            ++nSize;
+            while (*tmp) {
+                ++tmp;
+            }
         }
-    
+
         *parray = apr_array_make(p, nSize, sizeof(char *));
-        tmp = pValue;
-        newelem = (char **) apr_array_push(*parray);
-        *newelem = tmp;
-        while (tmp[0] || tmp[1])
-        {
-            if (!tmp[0]) {
-                newelem = (char **) apr_array_push(*parray);
-                *newelem = tmp + 1;
+        for (tmp = pValue; *tmp; ++tmp) {
+            newelem = (char **) apr_array_push(*parray);
+            *newelem = tmp;
+            while (*tmp) {
+                ++tmp;
             }
-            ++tmp;
         }
     }