mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Reformat mod_lua according to the HTTP Server Project C Style Guide:
<http://httpd.apache.org/dev/styleguide.html> No functional changes. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@728516 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -32,32 +32,36 @@
|
||||
#endif
|
||||
|
||||
|
||||
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);
|
||||
apr_table_t *t = (apr_table_t *) lua_unboxpointer(L, index);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
void apl_push_apr_table(lua_State* L, const char *name, apr_table_t *t) {
|
||||
lua_boxpointer(L, t);
|
||||
void apl_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) {
|
||||
static int lua_table_set(lua_State *L)
|
||||
{
|
||||
apr_table_t *t = check_apr_table(L, 1);
|
||||
const char* key = luaL_checkstring(L, 2);
|
||||
const char* val = luaL_checkstring(L, 3);
|
||||
const char *key = luaL_checkstring(L, 2);
|
||||
const char *val = luaL_checkstring(L, 3);
|
||||
|
||||
apr_table_set(t, key, val);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lua_table_get(lua_State* L) {
|
||||
static int lua_table_get(lua_State *L)
|
||||
{
|
||||
apr_table_t *t = check_apr_table(L, 1);
|
||||
const char* key = luaL_checkstring(L, 2);
|
||||
const char *key = luaL_checkstring(L, 2);
|
||||
const char *val = apr_table_get(t, key);
|
||||
lua_pushstring(L, val);
|
||||
return 1;
|
||||
@@ -70,7 +74,8 @@ static const luaL_reg lua_table_methods[] = {
|
||||
};
|
||||
|
||||
|
||||
int apr_lua_init(lua_State *L, apr_pool_t *p) {
|
||||
int apr_lua_init(lua_State *L, apr_pool_t *p)
|
||||
{
|
||||
luaL_newmetatable(L, "Apr.Table");
|
||||
luaL_openlib(L, "apr_table", lua_table_methods, 0);
|
||||
lua_pushstring(L, "__index");
|
||||
@@ -82,7 +87,6 @@ int apr_lua_init(lua_State *L, apr_pool_t *p) {
|
||||
lua_pushstring(L, "set");
|
||||
lua_gettable(L, 2);
|
||||
lua_settable(L, 1);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user