Skip to content

Commit aa4b1cf

Browse files
committed
fix symbol space and exports
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@758428 13f79535-47bb-0310-9956-ffa450edef68
1 parent 3a8d6ff commit aa4b1cf

10 files changed

Lines changed: 167 additions & 160 deletions

File tree

modules/lua/lua_apr.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
#include "apr.h"
1818
#include "apr_tables.h"
1919

20-
#include "lua.h"
21-
#include "lauxlib.h"
22-
#include "lualib.h"
20+
#include "mod_lua.h"
2321
#include "lua_apr.h"
2422

2523
/**
@@ -41,7 +39,7 @@ apr_table_t *check_apr_table(lua_State *L, int index)
4139
}
4240

4341

44-
void apl_push_apr_table(lua_State *L, apr_table_t *t)
42+
AP_LUA_DECLARE(void) ap_lua_push_apr_table(lua_State *L, apr_table_t *t)
4543
{
4644
lua_boxpointer(L, t);
4745
luaL_getmetatable(L, "Apr.Table");
@@ -74,7 +72,7 @@ static const luaL_reg lua_table_methods[] = {
7472
};
7573

7674

77-
int apr_lua_init(lua_State *L, apr_pool_t *p)
75+
AP_LUA_DECLARE(int) ap_lua_init(lua_State *L, apr_pool_t *p)
7876
{
7977
luaL_newmetatable(L, "Apr.Table");
8078
luaL_openlib(L, "apr_table", lua_table_methods, 0);

modules/lua/lua_apr.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#ifndef _LUA_APR_H_
1919
#define _LUA_APR_H_
2020

21-
int apr_lua_init(lua_State *L, apr_pool_t * p);
22-
apr_table_t *check_apr_table(lua_State *L, int index);
23-
void apl_push_apr_table(lua_State *L, apr_table_t *t);
21+
AP_LUA_DECLARE(int) ap_lua_init(lua_State *L, apr_pool_t * p);
22+
AP_LUA_DECLARE(apr_table_t*) ap_lua_check_apr_table(lua_State *L, int index);
23+
AP_LUA_DECLARE(void) ap_lua_push_apr_table(lua_State *L, apr_table_t *t);
2424

2525
#endif /* !_LUA_APR_H_ */

modules/lua/lua_config.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
#include "lua_config.h"
1919
#include "lua_vmprep.h"
2020

21-
static apl_dir_cfg *check_dir_config(lua_State *L, int index)
21+
static ap_lua_dir_cfg *check_dir_config(lua_State *L, int index)
2222
{
23-
apl_dir_cfg *cfg;
23+
ap_lua_dir_cfg *cfg;
2424
luaL_checkudata(L, index, "Apache2.DirConfig");
25-
cfg = (apl_dir_cfg *) lua_unboxpointer(L, index);
25+
cfg = (ap_lua_dir_cfg *) lua_unboxpointer(L, index);
2626
return cfg;
2727
}
2828

@@ -49,15 +49,16 @@ static int apl_toscope(const char *name)
4949
return APL_SCOPE_ONCE;
5050
}
5151

52-
apr_status_t apl_lua_map_handler(apl_dir_cfg *cfg,
53-
const char *file,
54-
const char *function,
55-
const char *pattern, const char *scope)
52+
AP_LUA_DECLARE(apr_status_t) ap_lua_map_handler(ap_lua_dir_cfg *cfg,
53+
const char *file,
54+
const char *function,
55+
const char *pattern,
56+
const char *scope)
5657
{
5758
ap_regex_t *uri_pattern;
5859
apr_status_t rv;
59-
apl_mapped_handler_spec *handler =
60-
apr_palloc(cfg->pool, sizeof(apl_mapped_handler_spec));
60+
ap_lua_mapped_handler_spec *handler =
61+
apr_palloc(cfg->pool, sizeof(ap_lua_mapped_handler_spec));
6162
handler->uri_pattern = NULL;
6263
handler->function_name = NULL;
6364

@@ -70,17 +71,17 @@ apr_status_t apl_lua_map_handler(apl_dir_cfg *cfg,
7071
handler->scope = apl_toscope(scope);
7172

7273
handler->function_name = apr_pstrdup(cfg->pool, function);
73-
*(const apl_mapped_handler_spec **) apr_array_push(cfg->mapped_handlers) =
74+
*(const ap_lua_mapped_handler_spec **) apr_array_push(cfg->mapped_handlers) =
7475
handler;
7576
return APR_SUCCESS;
7677
}
7778

78-
/* Change to use apl_lua_map_handler */
79+
/* Change to use ap_lua_map_handler */
7980
static int cfg_lua_map_handler(lua_State *L)
8081
{
81-
apl_dir_cfg *cfg = check_dir_config(L, 1);
82-
apl_mapped_handler_spec *handler =
83-
apr_palloc(cfg->pool, sizeof(apl_mapped_handler_spec));
82+
ap_lua_dir_cfg *cfg = check_dir_config(L, 1);
83+
ap_lua_mapped_handler_spec *handler =
84+
apr_palloc(cfg->pool, sizeof(ap_lua_mapped_handler_spec));
8485
handler->uri_pattern = NULL;
8586
handler->function_name = NULL;
8687

@@ -126,20 +127,20 @@ static int cfg_lua_map_handler(lua_State *L)
126127
lua_pop(L, 1);
127128

128129

129-
*(const apl_mapped_handler_spec **) apr_array_push(cfg->mapped_handlers) =
130+
*(const ap_lua_mapped_handler_spec **) apr_array_push(cfg->mapped_handlers) =
130131
handler;
131132
return 0;
132133
}
133134

134135
static int cfg_directory(lua_State *L)
135136
{
136-
apl_dir_cfg *cfg = check_dir_config(L, 1);
137+
ap_lua_dir_cfg *cfg = check_dir_config(L, 1);
137138
lua_pushstring(L, cfg->dir);
138139
return 1;
139140
}
140141

141142
/*static int cfg_root(lua_State *L) {
142-
apl_dir_cfg *cfg = check_dir_config(L, 1);
143+
ap_lua_dir_cfg *cfg = check_dir_config(L, 1);
143144
lua_pushstring(L, cfg->root_path);
144145
return 1;
145146
}*/
@@ -233,7 +234,7 @@ static const struct luaL_Reg cmd_methods[] = {
233234
{NULL, NULL}
234235
};
235236

236-
void apl_load_config_lmodule(lua_State *L)
237+
AP_LUA_DECLARE(void) ap_lua_load_config_lmodule(lua_State *L)
237238
{
238239
luaL_newmetatable(L, "Apache2.DirConfig"); /* [metatable] */
239240
lua_pushvalue(L, -1);

modules/lua/lua_config.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@
2020
#ifndef _APL_CONFIG_H_
2121
#define _APL_CONFIG_H_
2222

23-
APR_DECLARE(void) apl_load_config_lmodule(lua_State *L);
23+
AP_LUA_DECLARE(void) ap_lua_load_config_lmodule(lua_State *L);
2424

25-
APR_DECLARE(apr_status_t) apl_lua_map_handler(apl_dir_cfg *cfg,
26-
const char *file,
27-
const char *function,
28-
const char *pattern,
29-
const char *scope);
25+
AP_LUA_DECLARE(apr_status_t) ap_lua_map_handler(ap_lua_dir_cfg *cfg,
26+
const char *file,
27+
const char *function,
28+
const char *pattern,
29+
const char *scope);
3030

3131
#endif /* !_APL_CONFIG_H_ */

modules/lua/lua_request.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ typedef char *(*req_field_string_f) (request_rec * r);
2323
typedef int (*req_field_int_f) (request_rec * r);
2424
typedef apr_table_t *(*req_field_apr_table_f) (request_rec * r);
2525

26-
void apl_rstack_dump(lua_State *L, request_rec *r, const char *msg)
26+
void ap_lua_rstack_dump(lua_State *L, request_rec *r, const char *msg)
2727
{
2828
int i;
2929
int top = lua_gettop(L);
@@ -92,7 +92,7 @@ void apl_rstack_dump(lua_State *L, request_rec *r, const char *msg)
9292
* userdata thingamajig and return it if it is. if it is not
9393
* lua will enter its error handling routine.
9494
*/
95-
static request_rec *apl_check_request_rec(lua_State *L, int index)
95+
static request_rec *ap_lua_check_request_rec(lua_State *L, int index)
9696
{
9797
request_rec *r;
9898
luaL_checkudata(L, index, "Apache2.Request");
@@ -154,7 +154,7 @@ static int req_aprtable2luatable_cb(void *l, const char *key,
154154
static int req_parseargs(lua_State *L)
155155
{
156156
apr_table_t *form_table;
157-
request_rec *r = apl_check_request_rec(L, 1);
157+
request_rec *r = ap_lua_check_request_rec(L, 1);
158158
lua_newtable(L);
159159
lua_newtable(L); /* [table, table] */
160160
ap_args_to_table(r, &form_table);
@@ -165,7 +165,7 @@ static int req_parseargs(lua_State *L)
165165
/* wrap ap_rputs as r:puts(String) */
166166
static int req_puts(lua_State *L)
167167
{
168-
request_rec *r = apl_check_request_rec(L, 1);
168+
request_rec *r = ap_lua_check_request_rec(L, 1);
169169

170170
int argc = lua_gettop(L);
171171
int i;
@@ -179,7 +179,7 @@ static int req_puts(lua_State *L)
179179
/* wrap ap_rwrite as r:write(String) */
180180
static int req_write(lua_State *L)
181181
{
182-
request_rec *r = apl_check_request_rec(L, 1);
182+
request_rec *r = ap_lua_check_request_rec(L, 1);
183183
size_t n;
184184
const char *buf = luaL_checklstring(L, 2, &n);
185185

@@ -191,7 +191,7 @@ static int req_write(lua_State *L)
191191
static int req_parsebody(lua_State *L)
192192
{
193193
apr_table_t *form_table;
194-
request_rec *r = apl_check_request_rec(L, 1);
194+
request_rec *r = ap_lua_check_request_rec(L, 1);
195195
lua_newtable(L);
196196
lua_newtable(L);
197197
if (ap_body_to_table(r, &form_table) == APR_SUCCESS) {
@@ -203,7 +203,7 @@ static int req_parsebody(lua_State *L)
203203
/* r:addoutputfilter(name|function) */
204204
static int req_add_output_filter(lua_State *L)
205205
{
206-
request_rec *r = apl_check_request_rec(L, 1);
206+
request_rec *r = ap_lua_check_request_rec(L, 1);
207207
const char *name = luaL_checkstring(L, 2);
208208
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, "adding output filter %s",
209209
name);
@@ -214,7 +214,7 @@ static int req_add_output_filter(lua_State *L)
214214
/* BEGIN dispatch mathods for request_rec fields */
215215

216216
/* not really a field, but we treat it like one */
217-
static char *req_document_root(request_rec *r)
217+
static const char *req_document_root(request_rec *r)
218218
{
219219
return ap_document_root(r);
220220
}
@@ -321,7 +321,7 @@ static int req_dispatch(lua_State *L)
321321
{
322322
apr_hash_t *dispatch;
323323
req_fun_t *rft;
324-
request_rec *r = apl_check_request_rec(L, 1);
324+
request_rec *r = ap_lua_check_request_rec(L, 1);
325325
const char *name = luaL_checkstring(L, 2);
326326
lua_pop(L, 2);
327327

@@ -333,13 +333,13 @@ static int req_dispatch(lua_State *L)
333333
if (rft) {
334334
switch (rft->type) {
335335
case APL_REQ_FUNTYPE_TABLE:{
336+
apr_table_t *rs;
336337
req_field_apr_table_f func = rft->fun;
337338
ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r,
338339
"request_rec->dispatching %s -> apr table",
339340
name);
340-
apr_table_t *rs;
341341
rs = (*func)(r);
342-
apl_push_apr_table(L, rs);
342+
ap_lua_push_apr_table(L, rs);
343343
return 1;
344344
}
345345

@@ -389,7 +389,7 @@ static int req_dispatch(lua_State *L)
389389
static int req_log_at(lua_State *L, int level)
390390
{
391391
const char *msg;
392-
request_rec *r = apl_check_request_rec(L, 1);
392+
request_rec *r = ap_lua_check_request_rec(L, 1);
393393
lua_Debug dbg;
394394

395395
lua_getstack(L, 1, &dbg);
@@ -448,7 +448,7 @@ static int req_newindex(lua_State *L)
448448
const char *key;
449449
/* request_rec* r = lua_touserdata(L, lua_upvalueindex(1)); */
450450
/* const char* key = luaL_checkstring(L, -2); */
451-
request_rec *r = apl_check_request_rec(L, 1);
451+
request_rec *r = ap_lua_check_request_rec(L, 1);
452452
key = luaL_checkstring(L, 2);
453453
if (0 == apr_strnatcmp("status", key)) {
454454
int code = luaL_checkinteger(L, 3);
@@ -508,7 +508,7 @@ static req_fun_t *makefun(void *fun, int type, apr_pool_t *pool)
508508
return rft;
509509
}
510510

511-
void apl_load_request_lmodule(lua_State *L, apr_pool_t *p)
511+
AP_LUA_DECLARE(void) ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p)
512512
{
513513

514514
apr_hash_t *dispatch = apr_hash_make(p);
@@ -614,14 +614,14 @@ void apl_load_request_lmodule(lua_State *L, apr_pool_t *p)
614614

615615
}
616616

617-
void apl_push_connection(lua_State *L, conn_rec *c)
617+
void ap_lua_push_connection(lua_State *L, conn_rec *c)
618618
{
619619
lua_boxpointer(L, c);
620620
luaL_getmetatable(L, "Apache2.Connection");
621621
lua_setmetatable(L, -2);
622622
luaL_getmetatable(L, "Apache2.Connection");
623623

624-
apl_push_apr_table(L, c->notes);
624+
ap_lua_push_apr_table(L, c->notes);
625625
lua_setfield(L, -2, "notes");
626626

627627
lua_pushstring(L, c->remote_ip);
@@ -631,7 +631,7 @@ void apl_push_connection(lua_State *L, conn_rec *c)
631631
}
632632

633633

634-
void apl_push_server(lua_State *L, server_rec *s)
634+
void ap_lua_push_server(lua_State *L, server_rec *s)
635635
{
636636
lua_boxpointer(L, s);
637637
luaL_getmetatable(L, "Apache2.Server");
@@ -644,7 +644,7 @@ void apl_push_server(lua_State *L, server_rec *s)
644644
lua_pop(L, 1);
645645
}
646646

647-
void apl_push_request(lua_State *L, request_rec *r)
647+
AP_LUA_DECLARE(void) ap_lua_push_request(lua_State *L, request_rec *r)
648648
{
649649
lua_boxpointer(L, r);
650650
luaL_getmetatable(L, "Apache2.Request");

modules/lua/lua_request.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
* limitations under the License.
1616
*/
1717

18+
#include "mod_lua.h"
19+
1820
#ifndef _LUA_REQUEST_H_
1921
#define _LUA_REQUEST_H_
2022

21-
APR_DECLARE(void) apl_push_request(lua_State *L, request_rec *r);
22-
APR_DECLARE(void) apl_load_request_lmodule(lua_State *L, apr_pool_t *p);
23+
AP_LUA_DECLARE(void) ap_lua_push_request(lua_State *L, request_rec *r);
24+
AP_LUA_DECLARE(void) ap_lua_load_request_lmodule(lua_State *L, apr_pool_t *p);
2325

2426
#define APL_REQ_FUNTYPE_STRING 1
2527
#define APL_REQ_FUNTYPE_INT 2

modules/lua/lua_vmprep.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static void pstack_dump(lua_State *L, apr_pool_t *r, int level,
9595

9696
/* BEGIN apache lmodule */
9797

98-
void apl_load_apache2_lmodule(lua_State *L)
98+
AP_LUA_DECLARE(void) ap_lua_load_apache2_lmodule(lua_State *L)
9999
{
100100
lua_getglobal(L, "package");
101101
lua_getfield(L, -1, "loaded");
@@ -286,11 +286,12 @@ static int loadjitmodule(lua_State *L, apr_pool_t *lifecycle_pool) {
286286

287287
#endif
288288

289-
lua_State *apl_get_lua_state(apr_pool_t *lifecycle_pool,
290-
apl_vm_spec *spec,
291-
apr_array_header_t *package_paths,
292-
apr_array_header_t *package_cpaths,
293-
apl_lua_state_open_callback cb, void *btn)
289+
AP_LUA_DECLARE(lua_State*)ap_lua_get_lua_state(apr_pool_t *lifecycle_pool,
290+
ap_lua_vm_spec *spec,
291+
apr_array_header_t *package_paths,
292+
apr_array_header_t *package_cpaths,
293+
ap_lua_state_open_callback cb,
294+
void *btn)
294295
{
295296

296297
lua_State *L;

0 commit comments

Comments
 (0)