You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by wr...@apache.org on 2004/06/28 20:06:11 UTC

cvs commit: apr/file_io/os2 filesys.c

wrowe       2004/06/28 11:06:11

  Modified:    file_io/os2 filesys.c
  Log:
    Simplify excessive copies when the string isn't transformed to upper.
  
  Revision  Changes    Path
  1.10      +7 -6      apr/file_io/os2/filesys.c
  
  Index: filesys.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/filesys.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- filesys.c	13 Feb 2004 09:38:24 -0000	1.9
  +++ filesys.c	28 Jun 2004 18:06:11 -0000	1.10
  @@ -94,12 +94,13 @@
   
   apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p)
   {
  -    char path[APR_PATH_MAX];
  -
  -    strcpy(path, root);
  -    if (path[1] == ':')
  -        path[0] = apr_toupper(path[0]);
  -    *rootpath = apr_pstrdup(p, path);
  +    if (root[0] && apr_islower(root[0]) && root[1] == ':') {
  +        *rootpath = apr_pstrdup(p, root);
  +        (*rootpath)[0] = apr_toupper((*rootpath)[0]);
  +    }
  +    else {
  +       *rootpath = root;
  +    }
       return APR_SUCCESS;
   }