From b8c5fb6aded53d25d352eebb4ef17a14104023f5 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Mon, 28 Jun 2004 18:06:11 +0000 Subject: Simplify excessive copies when the string isn't transformed to upper. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65224 13f79535-47bb-0310-9956-ffa450edef68 --- file_io/os2/filesys.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'file_io/os2/filesys.c') diff --git a/file_io/os2/filesys.c b/file_io/os2/filesys.c index b323e488d..ef597b38e 100644 --- a/file_io/os2/filesys.c +++ b/file_io/os2/filesys.c @@ -94,12 +94,13 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, 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; } -- cgit v1.2.3