httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r712553 - in /httpd/mod_wombat/trunk: config.c mod_wombat.c mod_wombat.h request.c vmprep.c vmprep.h
Date Sun, 09 Nov 2008 20:46:14 GMT
Author: pquerna
Date: Sun Nov  9 12:46:13 2008
New Revision: 712553

URL: http://svn.apache.org/viewvc?rev=712553&view=rev
Log:
c89 support: convert all c++ style // comments to c89 /* */ style. no functional changes.

Modified:
    httpd/mod_wombat/trunk/config.c
    httpd/mod_wombat/trunk/mod_wombat.c
    httpd/mod_wombat/trunk/mod_wombat.h
    httpd/mod_wombat/trunk/request.c
    httpd/mod_wombat/trunk/vmprep.c
    httpd/mod_wombat/trunk/vmprep.h

Modified: httpd/mod_wombat/trunk/config.c
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/config.c?rev=712553&r1=712552&r2=712553&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/config.c (original)
+++ httpd/mod_wombat/trunk/config.c Sun Nov  9 12:46:13 2008
@@ -62,7 +62,7 @@
     return APR_SUCCESS;
 }
 
-// Change to use apw_lua_map_handler
+/* Change to use apw_lua_map_handler */
 static int cfg_lua_map_handler(lua_State *L) {
     apw_dir_cfg *cfg = check_dir_config(L, 1);
     apw_mapped_handler_spec *handler = apr_palloc(cfg->pool, sizeof(apw_mapped_handler_spec));
@@ -129,7 +129,7 @@
 static const struct luaL_Reg cfg_methods[] = {
     {"match_handler", cfg_lua_map_handler},
     {"directory", cfg_directory},
-   // {"root", cfg_root},
+   /* {"root", cfg_root}, */
     {NULL, NULL}
 };
 
@@ -141,7 +141,7 @@
     return 0;
 }
 
-// helper function for the logging functions below
+/* helper function for the logging functions below */
 static int cmd_log_at(lua_State* L, int level) {
     cmd_parms *cmd = check_cmd_parms(L, 1);
     lua_Debug dbg;
@@ -154,7 +154,7 @@
     return 0;
 }
 
-// r:debug(String) and friends which use apache logging
+/* r:debug(String) and friends which use apache logging */
 static int cmd_emerg(lua_State* L)  { cmd_log_at(L, APLOG_EMERG); return 0; }
 static int cmd_alert(lua_State* L)  { cmd_log_at(L, APLOG_ALERT); return 0; }
 static int cmd_crit(lua_State* L)   { cmd_log_at(L, APLOG_CRIT); return 0; }
@@ -181,17 +181,17 @@
 };
 
 void apw_load_config_lmodule(lua_State *L) {
-    luaL_newmetatable(L, "Apache2.DirConfig"); // [metatable]
+    luaL_newmetatable(L, "Apache2.DirConfig"); /* [metatable] */
     lua_pushvalue(L, -1); 
 
     lua_setfield(L, -2, "__index"); 
-    luaL_register(L, NULL, cfg_methods); // [metatable]
+    luaL_register(L, NULL, cfg_methods); /* [metatable] */
     
     
     luaL_newmetatable(L, "Apache2.CommandParameters");
     lua_pushvalue(L, -1); 
 
     lua_setfield(L, -2, "__index"); 
-    luaL_register(L, NULL, cmd_methods); // [metatable]
+    luaL_register(L, NULL, cmd_methods); /* [metatable] */
     
 }

Modified: httpd/mod_wombat/trunk/mod_wombat.c
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/mod_wombat.c?rev=712553&r1=712552&r2=712553&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/mod_wombat.c (original)
+++ httpd/mod_wombat/trunk/mod_wombat.c Sun Nov  9 12:46:13 2008
@@ -126,10 +126,10 @@
                                           cfg->package_cpaths,
                                           &wombat_open_callback, NULL); 
                                           
-        // lua_State *L = apw_rgetvm(r, spec);
+        /* lua_State *L = apw_rgetvm(r, spec); */
         ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "got a vm!");
         if (!L) {
-            // TODO annotate spec with failure reason
+            /* TODO annotate spec with failure reason */
             r->status = 500;
             ap_rputs("Unable to compile VM, see logs", r);
         }
@@ -173,7 +173,7 @@
             d->function_name = ap_pregsub(r->pool, cnd->function_name, r->uri,
AP_MAX_REG_MATCH, matches);
             d->spec = spec;
             
-            // now do replacement on method name where?
+            /* now do replacement on method name where? */
             r->filename = apr_pstrdup(r->pool, spec->file);
             apw_request_cfg *rcfg = ap_get_module_config(r->request_config, &wombat_module);
             rcfg->mapped_request_details = d;
@@ -183,7 +183,7 @@
     return DECLINED;    
 }
 
-// ---------------- Configury stuff --------------- //
+/* ---------------- Configury stuff --------------- */
 
 /** harnesses for magic hooks **/
 
@@ -518,7 +518,7 @@
 }
 
 void wombat_insert_filter_harness(request_rec *r) {
-    // ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "LuaHookInsertFilter not yet implemented");
+    /* ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, "LuaHookInsertFilter not yet implemented");
*/
 }
 
 int wombat_quick_harness(request_rec *r, int lookup) {
@@ -697,7 +697,7 @@
 }
 
 static const char* register_lua_root(cmd_parms *cmd, void *_cfg, const char *root) {
-    // apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg;
+    /* apw_dir_cfg* cfg = (apw_dir_cfg*)_cfg; */
     apw_server_cfg* cfg = ap_get_module_config(cmd->server->module_config, &wombat_module);
     
     cfg->root_path = root;
@@ -733,42 +733,42 @@
                      EXEC_ON_READ|OR_ALL,
                      "Provide a inline hook for the fixups phase of request processing"),
 
-// todo: test
+/* todo: test */
     AP_INIT_TAKE2("LuaHookMapToStorage", register_map_to_storage_hook, NULL, OR_ALL, 
                   "Provide a hook for the map_to_storage phase of request processing"),
     AP_INIT_RAW_ARGS("<LuaHookMapToStorage", register_map_to_storage_block, NULL,
                      EXEC_ON_READ|OR_ALL,
                      "Provide a hook for the map_to_storage phase of request processing"),
 
-    // todo: test
+    /* todo: test */
     AP_INIT_TAKE2("LuaHookCheckUserID", register_check_user_id_hook, NULL, OR_ALL, 
                   "Provide a hook for the check_user_id phase of request processing"),  
 
     AP_INIT_RAW_ARGS("<LuaHookCheckUserID", register_check_user_id_block, NULL,
                      EXEC_ON_READ|OR_ALL,
                      "Provide a hook for the check_user_id phase of request processing"),
   
 
-    // todo: test
+    /* todo: test */
     AP_INIT_TAKE2("LuaHookTypeChecker", register_type_checker_hook, NULL, OR_ALL, 
                   "Provide a hook for the type_checker phase of request processing"),
     AP_INIT_RAW_ARGS("<LuaHookTypeChecker", register_type_checker_block, NULL,
                      EXEC_ON_READ|OR_ALL,
                      "Provide a hook for the type_checker phase of request processing"),
 
-    // todo: test
+    /* todo: test */
     AP_INIT_TAKE2("LuaHookAccessChecker", register_access_checker_hook, NULL, OR_ALL, 
                   "Provide a hook for the access_checker phase of request processing"),
     AP_INIT_RAW_ARGS("<LuaHookAccessChecker", register_access_checker_block, NULL,
                      EXEC_ON_READ|OR_ALL,
                      "Provide a hook for the access_checker phase of request processing"),
 
-    // todo: test
+    /* todo: test */
     AP_INIT_TAKE2("LuaHookAuthChecker", register_auth_checker_hook, NULL, OR_ALL, 
                   "Provide a hook for the auth_checker phase of request processing"),
     AP_INIT_RAW_ARGS("<LuaHookAuthChecker", register_auth_checker_block, NULL,
                      EXEC_ON_READ|OR_ALL,
                      "Provide a hook for the auth_checker phase of request processing"),
 
-    // todo: test
+    /* todo: test */
     AP_INIT_TAKE2("LuaHookInsertFilter", register_insert_filter_hook, NULL, OR_ALL, 
                   "Provide a hook for the insert_filter phase of request processing"),
     
@@ -832,11 +832,11 @@
 }
 
 static void wombat_register_hooks(apr_pool_t *p) {
-    // ap_register_output_filter("wombathood", wombathood, NULL, AP_FTYPE_RESOURCE);
+    /* ap_register_output_filter("wombathood", wombathood, NULL, AP_FTYPE_RESOURCE); */
     ap_hook_handler(wombat_handler, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_create_request(create_request_config, NULL, NULL, APR_HOOK_MIDDLE);
     
-    // http_request.h hooks
+    /* http_request.h hooks */
     ap_hook_translate_name(wombat_translate_name_harness, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_fixups(wombat_fixup_harness, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_map_to_storage(wombat_map_to_storage_harness, NULL, NULL, APR_HOOK_MIDDLE);
@@ -847,7 +847,7 @@
     ap_hook_insert_filter(wombat_insert_filter_harness, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_quick_handler(wombat_quick_harness, NULL, NULL, APR_HOOK_FIRST);
 
-    // ap_hook_translate_name(wombat_alias_munger, NULL, NULL, APR_HOOK_MIDDLE);
+    /* ap_hook_translate_name(wombat_alias_munger, NULL, NULL, APR_HOOK_MIDDLE); */
     ap_hook_translate_name(apw_alias_munger, NULL, NULL, APR_HOOK_MIDDLE);    
 
     APR_OPTIONAL_HOOK(apw, wombat_open, wombat_open_hook, NULL, NULL,

Modified: httpd/mod_wombat/trunk/mod_wombat.h
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/mod_wombat.h?rev=712553&r1=712552&r2=712553&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/mod_wombat.h (original)
+++ httpd/mod_wombat/trunk/mod_wombat.h Sun Nov  9 12:46:13 2008
@@ -86,10 +86,10 @@
     unsigned int vm_server_pool_min;
     unsigned int vm_server_pool_max;
     
-    // info for the hook harnesses 
-    apr_hash_t *hooks; // <wombat_hook_info>
+    /* info for the hook harnesses */
+    apr_hash_t *hooks; /* <wombat_hook_info> */
     
-    // the actual directory being configured
+    /* the actual directory being configured */
     char *dir;
 } apw_dir_cfg;
 
@@ -98,7 +98,7 @@
     apr_hash_t *vm_reslists;
     apr_thread_rwlock_t *vm_reslists_lock;
 
-    // value of the LuaRoot directive
+    /* value of the LuaRoot directive */
     const char *root_path;    
 } apw_server_cfg;
 
@@ -118,7 +118,7 @@
 } apw_filter_ctx;
 
 extern module AP_MODULE_DECLARE_DATA wombat_module;
-// module wombat_module;
+/* module wombat_module; */
 
 #if !defined(WIN32)
 #define WOMBAT_DECLARE(type)            type

Modified: httpd/mod_wombat/trunk/request.c
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/request.c?rev=712553&r1=712552&r2=712553&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/request.c (original)
+++ httpd/mod_wombat/trunk/request.c Sun Nov  9 12:46:13 2008
@@ -93,63 +93,63 @@
 }
 
 /* ------------------ request methods -------------------- */
-// helper callback for req_parseargs
+/* helper callback for req_parseargs */
 static int req_aprtable2luatable_cb(void *l, const char *key, const char *value) {
-    lua_State* L = (lua_State*)l; // [table<s,t>, table<s,s>]
-    // rstack_dump(L, RRR, "start of cb");
-    // L is [table<s,t>, table<s,s>]
-    // build complex
+    lua_State* L = (lua_State*)l; /* [table<s,t>, table<s,s>] */
+    /* rstack_dump(L, RRR, "start of cb"); */
+    /* L is [table<s,t>, table<s,s>] */
+    /* build complex */
 
-    lua_getfield(L, -1, key); // [VALUE, table<s,t>, table<s,s>]
-    // rstack_dump(L, RRR, "after getfield");    
+    lua_getfield(L, -1, key); /* [VALUE, table<s,t>, table<s,s>] */
+    /* rstack_dump(L, RRR, "after getfield"); */ 
     int t = lua_type(L, -1);
     switch(t) {
         case LUA_TNIL:
         case LUA_TNONE: {
-            lua_pop(L, 1); // [table<s,t>, table<s,s>]
-            lua_newtable(L); // [array, table<s,t>, table<s,s>]
-            lua_pushnumber(L, 1); // [1, array, table<s,t>, table<s,s>]
-            lua_pushstring(L, value); // [string, 1, array, table<s,t>, table<s,s>]
-            lua_settable(L, -3); // [array, table<s,t>, table<s,s>] 
-            lua_setfield(L, -2, key); // [table<s,t>, table<s,s>]
+            lua_pop(L, 1); /* [table<s,t>, table<s,s>] */
+            lua_newtable(L); /* [array, table<s,t>, table<s,s>] */
+            lua_pushnumber(L, 1); /* [1, array, table<s,t>, table<s,s>] */
+            lua_pushstring(L, value); /* [string, 1, array, table<s,t>, table<s,s>]
*/
+            lua_settable(L, -3); /* [array, table<s,t>, table<s,s>]  */
+            lua_setfield(L, -2, key); /* [table<s,t>, table<s,s>] */
             break;
         }
         case LUA_TTABLE: {
-            // [array, table<s,t>, table<s,s>]
+            /* [array, table<s,t>, table<s,s>] */
             int size = lua_objlen(L, -1);
-            lua_pushnumber(L, size + 1); // [#, array, table<s,t>, table<s,s>]
-            lua_pushstring(L, value); // [string, #, array, table<s,t>, table<s,s>]
-            lua_settable(L, -3); // [array, table<s,t>, table<s,s>]         
   
-            lua_setfield(L, -2, key); // [table<s,t>, table<s,s>] 
+            lua_pushnumber(L, size + 1); /* [#, array, table<s,t>, table<s,s>]
*/
+            lua_pushstring(L, value); /* [string, #, array, table<s,t>, table<s,s>]
*/
+            lua_settable(L, -3); /* [array, table<s,t>, table<s,s>] */
+            lua_setfield(L, -2, key); /* [table<s,t>, table<s,s>] */
             break;
         }
     }
 
-    // L is [table<s,t>, table<s,s>]
-    // build simple
-    lua_getfield(L, -2, key); // [VALUE, table<s,s>, table<s,t>]
-    if (lua_isnoneornil(L, -1)) { // only set if not already set
-        lua_pop(L, 1); // [table<s,s>, table<s,t>]]
-        lua_pushstring(L, value); // [string, table<s,s>, table<s,t>]
-        lua_setfield(L, -3, key); // [table<s,s>, table<s,t>] 
+    /* L is [table<s,t>, table<s,s>] */
+    /* build simple */
+    lua_getfield(L, -2, key); /* [VALUE, table<s,s>, table<s,t>] */
+    if (lua_isnoneornil(L, -1)) { /* only set if not already set */
+        lua_pop(L, 1); /* [table<s,s>, table<s,t>]] */
+        lua_pushstring(L, value); /* [string, table<s,s>, table<s,t>] */
+        lua_setfield(L, -3, key); /* [table<s,s>, table<s,t>]  */
     } else { lua_pop(L, 1); }
     return 1;
 }
 
-// r:parseargs() returning a lua table
+/* r:parseargs() returning a lua table */
 static int req_parseargs(lua_State* L) {
     request_rec* r = apw_check_request_rec(L, 1);
     apreq_handle_t* h = apreq_handle_apache2(r);
     lua_newtable(L);
-    lua_newtable(L); // [table, table]
+    lua_newtable(L); /* [table, table] */
     const apr_table_t* form_table;
     if (apreq_args(h, &form_table) == APR_SUCCESS) {
         apr_table_do(req_aprtable2luatable_cb, L, form_table, NULL);                
     }
-    return 2; // [table<string, string>, table<string, array<string>>]
+    return 2; /* [table<string, string>, table<string, array<string>>]
*/
 }
 
-// wrap ap_rputs as r:puts(String)
+/* wrap ap_rputs as r:puts(String) */
 static int req_puts(lua_State* L) {    
     request_rec* r = apw_check_request_rec(L, 1);
     
@@ -162,7 +162,7 @@
     return 0;
 }
 
-// wrap ap_rwrite as r:write(String)
+/* wrap ap_rwrite as r:write(String) */
 static int req_write(lua_State* L) {
     request_rec* r = apw_check_request_rec(L, 1);
     size_t n;
@@ -172,7 +172,7 @@
     return 0;
 }
 
-// r:parsebody()
+/* r:parsebody() */
 static int req_parsebody(lua_State* L) {
     request_rec* r = apw_check_request_rec(L, 1);
     apreq_handle_t* h = apreq_handle_apache2(r);
@@ -185,7 +185,7 @@
     return 2;
 }
 
-// r:addoutputfilter(name|function)
+/* r:addoutputfilter(name|function) */
 static int req_add_output_filter(lua_State *L) {
     request_rec* r = apw_check_request_rec(L, 1);    
     const char *name = luaL_checkstring(L, 2);
@@ -330,7 +330,7 @@
     return 0;
 }
 
-// helper function for the logging functions below
+/* helper function for the logging functions below */
 static int req_log_at(lua_State* L, int level) {
     request_rec* r = apw_check_request_rec(L, 1);
     lua_Debug dbg;
@@ -343,7 +343,7 @@
     return 0;
 }
 
-// r:debug(String) and friends which use apache logging
+/* r:debug(String) and friends which use apache logging */
 static int req_emerg(lua_State* L)  { req_log_at(L, APLOG_EMERG); return 0; }
 static int req_alert(lua_State* L)  { req_log_at(L, APLOG_ALERT); return 0; }
 static int req_crit(lua_State* L)   { req_log_at(L, APLOG_CRIT); return 0; }
@@ -353,10 +353,10 @@
 static int req_info(lua_State* L)   { req_log_at(L, APLOG_INFO); return 0; }
 static int req_debug(lua_State* L)  { req_log_at(L, APLOG_DEBUG); return 0; }
 
-// handle r.status = 201
+/* handle r.status = 201 */
 static int req_newindex(lua_State* L) {
-    // request_rec* r = lua_touserdata(L, lua_upvalueindex(1));    
-    // const char* key = luaL_checkstring(L, -2);
+    /* request_rec* r = lua_touserdata(L, lua_upvalueindex(1)); */ 
+    /* const char* key = luaL_checkstring(L, -2); */
     request_rec* r = apw_check_request_rec(L, 1);
     rstack_dump(L, r, "req_newindex");
     const char *key = luaL_checkstring(L, 2);
@@ -409,7 +409,7 @@
 static const struct luaL_Reg request_methods[] = {
     {"__index", req_dispatch},
     {"__newindex", req_newindex},
-    //   {"__newindex", req_set_field},    
+    /*   {"__newindex", req_set_field}, */
     {NULL, NULL}
 };
 
@@ -501,27 +501,27 @@
     lua_pushlightuserdata(L, dispatch);
     lua_setfield(L, LUA_REGISTRYINDEX, "Apache2.Request.dispatch");
     
-    luaL_newmetatable(L, "Apache2.Request"); // [metatable]
+    luaL_newmetatable(L, "Apache2.Request"); /* [metatable] */
     lua_pushvalue(L, -1); 
 
     lua_setfield(L, -2, "__index"); 
-    luaL_register(L, NULL, request_methods); // [metatable]
+    luaL_register(L, NULL, request_methods); /* [metatable] */
 
     lua_pop(L, 2);
 
-    luaL_newmetatable(L, "Apache2.Connection"); // [metatable]
+    luaL_newmetatable(L, "Apache2.Connection"); /* [metatable] */
     lua_pushvalue(L, -1); 
 
     lua_setfield(L, -2, "__index"); 
-    luaL_register(L, NULL, connection_methods); // [metatable]
+    luaL_register(L, NULL, connection_methods); /* [metatable] */
 
     lua_pop(L, 2);
 
-    luaL_newmetatable(L, "Apache2.Server"); // [metatable]
+    luaL_newmetatable(L, "Apache2.Server"); /* [metatable] */
     lua_pushvalue(L, -1); 
 
     lua_setfield(L, -2, "__index"); 
-    luaL_register(L, NULL, server_methods); // [metatable]
+    luaL_register(L, NULL, server_methods); /* [metatable] */
 
     lua_pop(L, 2);
 

Modified: httpd/mod_wombat/trunk/vmprep.c
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/vmprep.c?rev=712553&r1=712552&r2=712553&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/vmprep.c (original)
+++ httpd/mod_wombat/trunk/vmprep.c Sun Nov  9 12:46:13 2008
@@ -22,7 +22,7 @@
 #include "config.h"
 #include "apr_file_info.h"
 
-// forward dec'l from this file
+/* forward dec'l from this file */
 static int load_file(apr_pool_t *working_pool, lua_State* L, const apw_code_cache* cfg, apw_vm_spec
*spec);
 
 void pstack_dump(lua_State* L, apr_pool_t* r, int level, const char* msg) {
@@ -100,7 +100,7 @@
     lua_newtable(L);    
     lua_setfield(L, -2, "apache2");
     lua_setglobal(L, "apache2");
-    lua_pop(L, 1); // empty stack
+    lua_pop(L, 1); /* empty stack */
 
     lua_getglobal(L, "apache2");
     lua_pushinteger(L, OK);
@@ -222,7 +222,7 @@
 
 /*  END library functions */
 
-// callback for cleaning up a lua vm when pool is closed
+/* callback for cleaning up a lua vm when pool is closed */
 static apr_status_t cleanup_lua(void *l) {
   lua_close((lua_State*) l);
   return APR_SUCCESS;
@@ -254,7 +254,7 @@
   }
   lua_pushstring(L, part);
   lua_setfield(L, -2, field);
-  lua_pop(L, 1); // pop "package" off the stack    
+  lua_pop(L, 1); /* pop "package" off the stack     */
 }
 
 
@@ -292,7 +292,7 @@
     apw_server_cfg *cfg = ap_get_module_config(params->server->module_config, &wombat_module);
   
     lua_State *L = create_vm(params->spec, cfg->code_cache, pool);
     *resource = L;
-    // ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, params->server, "L is %d", (int)L);
+    /* ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, params->server, "L is %d", (int)L); */
     return OK;
 }
 
@@ -311,7 +311,7 @@
     return APR_SUCCESS;
 }
 
-// Initially we will just use a resource list keyed to the file name
+/* Initially we will just use a resource list keyed to the file name */
 static lua_State* get_server_vm(server_rec *server, apw_vm_spec *spec) {
     apr_status_t rv;
     apw_server_cfg *cfg = ap_get_module_config(server->module_config, &wombat_module);
@@ -321,7 +321,7 @@
     apr_thread_rwlock_unlock(cfg->vm_reslists_lock);
     if (!rlist) {
         apr_thread_rwlock_wrlock(cfg->vm_reslists_lock);    
-        // double checked lock (works in C :-)
+        /* double checked lock (works in C :-) */
         rlist = apr_hash_get(cfg->vm_reslists, spec->file, APR_HASH_KEY_STRING);
         if (!rlist) {
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Creating RESLIST");
@@ -336,9 +336,9 @@
             params->spec->package_paths = spec->package_paths;
             params->spec->package_cpaths = spec->package_cpaths;
             ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Creating reslist for %s", spec->file);
-            rv = apr_reslist_create(&rlist,      // the list
-                                    10, 100, 100, // min, soft max, hard max
-                                    0,           // TTL
+            rv = apr_reslist_create(&rlist,      /* the list */
+                                    10, 100, 100, /* min, soft max, hard max */
+                                    0,           /* TTL */
                                     server_vm_ctor,
                                     server_vm_dtor,
                                     params,
@@ -356,15 +356,15 @@
     srt->L = L;
     apr_pool_cleanup_register(spec->pool, srt, release_server_vm, apr_pool_cleanup_null);
     
-    // apr_pool_cleanup_register(r->pool, L, cleanup_lua, apr_pool_cleanup_null);    
           
+    /* apr_pool_cleanup_register(r->pool, L, cleanup_lua, apr_pool_cleanup_null); */
     
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "Acquired lua_State %d", (int)L);
     return L;
 }
 
-// Initially we will just use a resource list keyed to the file name
+/* Initially we will just use a resource list keyed to the file name */
 static lua_State* get_request_vm(request_rec *r, apw_vm_spec *spec) {
-    // apr_status_t rv;
+    /* apr_status_t rv; */
     apw_request_cfg *cfg = ap_get_module_config(r->request_config, &wombat_module);
     apw_server_cfg *server_cfg = ap_get_module_config(r->server->module_config, &wombat_module);
   
     
@@ -411,7 +411,7 @@
 
         default:
             ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "Unknown Lua VM scope specified, using
'once'");
-            // fall through on purpose
+            /* fall through on purpose */
         case APW_SCOPE_ONCE:
             spec->package_paths = cfg->package_paths;
             spec->package_cpaths = cfg->package_cpaths;
@@ -426,7 +426,7 @@
     return L;
 }
 
-// returns NULL if the spec requires a request scope
+/* returns NULL if the spec requires a request scope */
 lua_State* apw_cgetvm(conn_rec *conn, apw_vm_spec *spec) {
     
     return NULL;
@@ -453,7 +453,7 @@
     
     apr_pool_t *pool = NULL;
     ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, server, "ALLOCATING A LUA");
-    // TODO change to use load_file
+    /* TODO change to use load_file */
     lua_State* L = luaL_newstate();
     luaL_openlibs(L);
     apw_load_apache2_lmodule(L);
@@ -506,16 +506,16 @@
     return L;
 }
 
-// represents a cache entry
+/* represents a cache entry */
 typedef struct {
-    apr_array_header_t *parts; // <part_t>
+    apr_array_header_t *parts; /* <part_t> */
     apr_time_t mtime;
     apr_pool_t *pool;
 } code_cache_entry;
 
 typedef struct {
     apr_pool_t *pool;
-    apr_array_header_t *parts; // <part_t>
+    apr_array_header_t *parts; /* <part_t> */
 } dumper_t;
 
 typedef struct {
@@ -542,13 +542,13 @@
 
 static const char* wlua_loader(lua_State* L, void* data, size_t* size) {
     loader_t* l = (loader_t*) data;
-    // ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, l->r, "part count %d", l->parts->nelts);
+    /* ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, l->r, "part count %d", l->parts->nelts);
*/
     if (l->idx == l->parts->nelts) {
         return NULL;
     }
     part_t* part = ((part_t**)l->parts->elts)[l->idx++];
     *size = part->sz;
-    // ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, l->r, "got part of size %lu", *size);
+    /* ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, l->r, "got part of size %lu", *size);
*/
     return part->chunk;
 }
 
@@ -563,7 +563,7 @@
         }
     }
     else if (spec->code_cache_style != APW_CODE_CACHE_NEVER) {
-        // start code caching magic
+        /* start code caching magic */
         apr_thread_rwlock_rdlock(cfg->compiled_files_lock);
         code_cache_entry *cache = apr_hash_get(cfg->compiled_files, spec->file, APR_HASH_KEY_STRING);
         apr_thread_rwlock_unlock(cfg->compiled_files_lock);
@@ -576,9 +576,9 @@
             finfo = apr_palloc(working_pool, sizeof(apr_finfo_t));
             apr_stat(finfo, spec->file, APR_FINFO_MTIME, working_pool);
 
-            // has the file been modified or is this the first time we load the file?
+            /* has the file been modified or is this the first time we load the file? */
             if (cache == NULL || finfo->mtime > cache->mtime) {
-                // we're expired
+                /* we're expired */
                 ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, working_pool, "file is stale: %s
", spec->file);
                 stale = 1;
             }
@@ -625,17 +625,18 @@
             
             int is_new = 0;
             if (!cache) { 
-                // allocate a new code_cache_entry from the cfg pool. Since entries are reused
-                // when files are re-loaded and we don't evict entries from the cache, 
-                // we don't need to care about de-allocation. 
+                /* allocate a new code_cache_entry from the cfg pool. Since entries are reused
+                 * when files are re-loaded and we don't evict entries from the cache, 
+                 * we don't need to care about de-allocation. 
+                 */
                 cache = apr_palloc(cfg->pool, sizeof(code_cache_entry));
                 is_new = 1;
             }
             
             
             apr_pool_t *mp;
-            apr_pool_create(&mp, cfg->pool);  // pool from which everything in this
code_cache_entry
-                                              // will be allocated
+            apr_pool_create(&mp, cfg->pool);  /* pool from which everything in this
code_cache_entry
+                                               * will be allocated */
 
             dumper_t* d = apr_palloc(working_pool, sizeof(dumper_t));
             d->pool = mp;
@@ -645,8 +646,9 @@
             apr_thread_rwlock_wrlock(cfg->compiled_files_lock);
             
             if (is_new) {
-                // we copy the filename into a string allocated from the cfg pool. apr_hash
keeps
-                // pointers to keys and values, and we need the key to survive beyond the
request lifetime
+                /* we copy the filename into a string allocated from the cfg pool. apr_hash
keeps
+                 * pointers to keys and values, and we need the key to survive beyond the
request lifetime
+                 */
                 const char* key = apr_pstrdup(cfg->pool, spec->file);
                 apr_hash_set(cfg->compiled_files, key, APR_HASH_KEY_STRING, cache);
             }
@@ -660,10 +662,10 @@
             
             apr_thread_rwlock_unlock(cfg->compiled_files_lock);
 
-            // end code caching magic            
+            /* end code caching magic             */
         }
     }
-    else { // CODE_CACHE_NEVER
+    else { /* CODE_CACHE_NEVER */
         ap_log_perror(APLOG_MARK, APLOG_DEBUG, 0, working_pool, "loading: %s", spec->file);
         
         if ((rs = luaL_loadfile(L, spec->file))) {
@@ -685,7 +687,7 @@
     
     lua_State* L;
     if (!apr_pool_userdata_get((void**)&L, file, lifecycle_pool)) {
-        // not available, so create
+        /* not available, so create */
         L =  luaL_newstate();
         luaL_openlibs(L);        
         if (package_paths) 

Modified: httpd/mod_wombat/trunk/vmprep.h
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/vmprep.h?rev=712553&r1=712552&r2=712553&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/vmprep.h (original)
+++ httpd/mod_wombat/trunk/vmprep.h Sun Nov  9 12:46:13 2008
@@ -48,20 +48,20 @@
  */ 
 typedef struct {
 
-    // NEED TO ADD ADDITIONAL PACKAGE PATHS AS PART OF SPEC INSTEAD OF DIR CONFIG
+    /* NEED TO ADD ADDITIONAL PACKAGE PATHS AS PART OF SPEC INSTEAD OF DIR CONFIG */
     apr_array_header_t* package_paths;
     apr_array_header_t* package_cpaths;
     
-    // name of base file to load in the vm
+    /* name of base file to load in the vm */
     char *file;             
 
-    // APW_CODE_CACHE_STAT | APW_CODE_CACHE_FOREVER | APW_CODE_CACHE_NEVER
+    /* APW_CODE_CACHE_STAT | APW_CODE_CACHE_FOREVER | APW_CODE_CACHE_NEVER */
     int code_cache_style;
 
-    // APW_SCOPE_ONCE | APW_SCOPE_REQUEST | APW_SCOPE_CONN | APW_SCOPE_SERVER
+    /* APW_SCOPE_ONCE | APW_SCOPE_REQUEST | APW_SCOPE_CONN | APW_SCOPE_SERVER */
     int scope;
     
-    // pool to use for lifecycle if APW_SCOPE_ONCE is set, otherwise unused
+    /* pool to use for lifecycle if APW_SCOPE_ONCE is set, otherwise unused */
     apr_pool_t *pool;
 
     const char *bytecode;
@@ -84,10 +84,10 @@
     apr_thread_rwlock_t* compiled_files_lock;
 } apw_code_cache;
 
-// remove and make static once out of mod_wombat.c
+/* remove and make static once out of mod_wombat.c */
 void apw_openlibs(lua_State* L);
 
-// remove and make static once out of mod_wombat.c
+/* remove and make static once out of mod_wombat.c */
 void apw_registerlib(lua_State* L, char* name, lua_CFunction f);
 
 /**
@@ -102,24 +102,26 @@
  */
 lua_State* apw_rgetvm(request_rec *r, apw_vm_spec *spec);
 
-// returns NULL if the spec requires a request scope
+/* returns NULL if the spec requires a request scope */
 lua_State* apw_cgetvm(conn_rec *r, apw_vm_spec *spec);
 
-// returns NULL if the spec requires a request scope or conn scope
+/* returns NULL if the spec requires a request scope or conn scope */
 lua_State* apw_sgetvm(server_rec *r, apw_vm_spec *spec);
 
 typedef void (*apw_lua_state_open_callback) (lua_State* L, apr_pool_t* p, void* ctx);
 
-// alternate means of getting lua_State (preferred eventually)
-// Obtain a lua_State which has loaded file and is associated with lifecycle_pool
-// If one exists, will return extant one, otherwise will create, attach, and return
-// This does no locking around the lua_State, so if the pool is shared between
-// threads, locking is up the client.
-//
-// @lifecycle_pool -> pool whose lifeycle controls the lua_State
-// @file file to be opened, also used as a key for uniquing lua_States
-// @cb callback for vm initialization called *before* the file is opened
-// @ctx a baton passed to cb
+/*
+ * alternate means of getting lua_State (preferred eventually)
+ * Obtain a lua_State which has loaded file and is associated with lifecycle_pool
+ * If one exists, will return extant one, otherwise will create, attach, and return
+ * This does no locking around the lua_State, so if the pool is shared between
+ * threads, locking is up the client.
+ * 
+ * @lifecycle_pool -> pool whose lifeycle controls the lua_State
+ * @file file to be opened, also used as a key for uniquing lua_States
+ * @cb callback for vm initialization called *before* the file is opened
+ * @ctx a baton passed to cb
+ */
 lua_State* apw_get_lua_state(apr_pool_t* lifecycle_pool, 
                              char* file, 
                              apr_array_header_t* package_paths, 



Mime
View raw message