httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject svn commit: r651865 - in /httpd/mod_wombat/trunk: README apr_lua.c apr_lua.h request.c
Date Sat, 26 Apr 2008 22:06:16 GMT
Author: brianm
Date: Sat Apr 26 15:06:14 2008
New Revision: 651865

URL: http://svn.apache.org/viewvc?rev=651865&view=rev
Log:
Clean up some of the APR mappings

Modified:
    httpd/mod_wombat/trunk/README
    httpd/mod_wombat/trunk/apr_lua.c
    httpd/mod_wombat/trunk/apr_lua.h
    httpd/mod_wombat/trunk/request.c

Modified: httpd/mod_wombat/trunk/README
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/README?rev=651865&r1=651864&r2=651865&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/README (original)
+++ httpd/mod_wombat/trunk/README Sat Apr 26 15:06:14 2008
@@ -19,8 +19,6 @@
         somewhere, but sometimes cannot put there, so... fun
         
     Filters
-
-    Better apr table binding
     
     Mapping in the server_rec
     

Modified: httpd/mod_wombat/trunk/apr_lua.c
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/apr_lua.c?rev=651865&r1=651864&r2=651865&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/apr_lua.c (original)
+++ httpd/mod_wombat/trunk/apr_lua.c Sat Apr 26 15:06:14 2008
@@ -5,12 +5,28 @@
 #include "lauxlib.h"
 #include "lualib.h"
 
-#define lua_unboxpointer(L,i)      (*(void **)(lua_touserdata(L, i)))
+/**
+ * make a userdata out of a C pointer, and vice versa
+ * instead of using lightuserdata
+ */
+#ifndef lua_boxpointer
+#define lua_boxpointer(L,u) (*(void **)(lua_newuserdata(L, sizeof(void *))) = (u))
+#define lua_unboxpointer(L,i)	(*(void **)(lua_touserdata(L, i)))
+#endif
 
-static apr_table_t* check_apr_table(lua_State* L, int index) {
+
+apr_table_t* check_apr_table(lua_State* L, int index) {
     luaL_checkudata(L, index, "Apr.Table");
     apr_table_t* t = (apr_table_t*)lua_unboxpointer(L, index);
     return t;
+}
+
+
+void apw_push_apr_table(lua_State* L, const char *name, apr_table_t *t) {
+    lua_boxpointer(L, t);    
+    luaL_getmetatable(L, "Apr.Table");
+    lua_setmetatable(L, -2);
+    lua_setfield(L, -2, name);
 }
 
 static int lua_table_set(lua_State* L) {

Modified: httpd/mod_wombat/trunk/apr_lua.h
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/apr_lua.h?rev=651865&r1=651864&r2=651865&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/apr_lua.h (original)
+++ httpd/mod_wombat/trunk/apr_lua.h Sat Apr 26 15:06:14 2008
@@ -2,5 +2,7 @@
 #define _APR_LUA_H_
 
 int apr_lua_init(lua_State *L, apr_pool_t *p);
+apr_table_t* check_apr_table(lua_State* L, int index);
+void apw_push_apr_table(lua_State* L, const char *name, apr_table_t *t);
 
 #endif

Modified: httpd/mod_wombat/trunk/request.c
URL: http://svn.apache.org/viewvc/httpd/mod_wombat/trunk/request.c?rev=651865&r1=651864&r2=651865&view=diff
==============================================================================
--- httpd/mod_wombat/trunk/request.c (original)
+++ httpd/mod_wombat/trunk/request.c Sat Apr 26 15:06:14 2008
@@ -16,6 +16,7 @@
  */
 
 #include "mod_wombat.h"
+#include "apr_lua.h"
 
 void rstack_dump(lua_State* L, request_rec* r, const char* msg) {
     ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, "Lua Stack Dump: [%s]", msg);
@@ -286,14 +287,6 @@
 static const struct luaL_Reg server_methods[] = {
     {NULL, NULL}
 };
-
-void apw_push_apr_table(lua_State* L, const char *name, apr_table_t *t) {
-    lua_boxpointer(L, t);    
-    luaL_getmetatable(L, "Apr.Table");
-    lua_setmetatable(L, -2);
-    lua_setfield(L, -2, name);
-}
-
 
 void apw_load_request_lmodule(lua_State *L) {
     luaL_newmetatable(L, "Apache2.Request"); // [metatable]



Mime
View raw message