You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2002/05/25 22:02:16 UTC

cvs commit: httpd-2.0/server/mpm/winnt registry.c

wrowe       02/05/25 13:02:16

  Modified:    server/mpm/winnt registry.c
  Log:
    nelts returned from a registry key may be zero... make it so.
    [We previously would return an array of one empty element.]
  
  PR: 9410
  Submitted by:	Vasiliy Gagin <va...@gazooc.com>
  
  Revision  Changes    Path
  1.34      +12 -17    httpd-2.0/server/mpm/winnt/registry.c
  
  Index: registry.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/registry.c,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- registry.c	17 May 2002 11:11:39 -0000	1.33
  +++ registry.c	25 May 2002 20:02:16 -0000	1.34
  @@ -266,26 +266,21 @@
   			     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;
           }
       }