From: Stefan Fritsch Date: Sun, 17 Jul 2011 16:33:03 +0000 (+0000) Subject: Simplify code by using apr_array_pstrcat() X-Git-Tag: 2.3.14^2~40 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae3664de2ca72905ad4d7e2cf8804124065b2166;p=thirdparty%2Fapache%2Fhttpd.git Simplify code by using apr_array_pstrcat() git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1147680 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/lua/lua_vmprep.c b/modules/lua/lua_vmprep.c index f7d535e892c..b681ef1f161 100644 --- a/modules/lua/lua_vmprep.c +++ b/modules/lua/lua_vmprep.c @@ -246,7 +246,6 @@ static void munge_path(lua_State *L, const char *pattern; const char *modified; char *part; - int i; lua_getglobal(L, "package"); lua_getfield(L, -1, field); @@ -259,11 +258,8 @@ static void munge_path(lua_State *L, modified = lua_tostring(L, -1); lua_pop(L, 2); - part = apr_pstrdup(pool, modified); - for (i = 0; i < paths->nelts; i++) { - const char *new_path = ((const char **) paths->elts)[i]; - part = apr_pstrcat(pool, part, ";", new_path, NULL); - } + part = apr_pstrcat(pool, modified, apr_array_pstrcat(pool, paths, ';'), + NULL); lua_pushstring(L, part); lua_setfield(L, -2, field); lua_pop(L, 1); /* pop "package" off the stack */