wrowe 2004/06/28 11:06:48
Modified: file_io/os2 Tag: APR_0_9_BRANCH filesys.c
Log:
Simplify excessive copies when the string isn't transformed to upper.
Backport of rev 1.10
Reviewed by: trawick
Revision Changes Path
No revision
No revision
1.8.2.2 +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.8.2.1
retrieving revision 1.8.2.2
diff -u -r1.8.2.1 -r1.8.2.2
--- filesys.c 13 Feb 2004 09:33:42 -0000 1.8.2.1
+++ filesys.c 28 Jun 2004 18:06:48 -0000 1.8.2.2
@@ -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;
}