httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s.@apache.org
Subject svn commit: r1147680 - /httpd/httpd/trunk/modules/lua/lua_vmprep.c
Date Sun, 17 Jul 2011 16:33:04 GMT
Author: sf
Date: Sun Jul 17 16:33:03 2011
New Revision: 1147680

URL: http://svn.apache.org/viewvc?rev=1147680&view=rev
Log:
Simplify code by using apr_array_pstrcat()

Modified:
    httpd/httpd/trunk/modules/lua/lua_vmprep.c

Modified: httpd/httpd/trunk/modules/lua/lua_vmprep.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_vmprep.c?rev=1147680&r1=1147679&r2=1147680&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/lua/lua_vmprep.c (original)
+++ httpd/httpd/trunk/modules/lua/lua_vmprep.c Sun Jul 17 16:33:03 2011
@@ -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     */



Mime
View raw message