3232 *
3333 * */
3434static ngx_int_t
35- ngx_http_lua_cache_load_code (ngx_http_request_t * r , lua_State * L ,
35+ ngx_http_lua_cache_load_code (ngx_log_t * log , lua_State * L ,
3636 const char * key )
3737{
3838 int rc ;
@@ -68,7 +68,7 @@ ngx_http_lua_cache_load_code(ngx_http_request_t *r, lua_State *L,
6868 err = (u_char * ) "unknown error" ;
6969 }
7070
71- ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
71+ ngx_log_error (NGX_LOG_ERR , log , 0 ,
7272 "lua: failed to run factory at key \"%s\": %s" ,
7373 key , err );
7474 lua_pop (L , 2 );
@@ -133,7 +133,7 @@ ngx_http_lua_cache_store_code(lua_State *L, const char *key)
133133
134134
135135ngx_int_t
136- ngx_http_lua_cache_loadbuffer (ngx_http_request_t * r , lua_State * L ,
136+ ngx_http_lua_cache_loadbuffer (ngx_log_t * log , lua_State * L ,
137137 const u_char * src , size_t src_len , const u_char * cache_key ,
138138 const char * name )
139139{
@@ -145,7 +145,7 @@ ngx_http_lua_cache_loadbuffer(ngx_http_request_t *r, lua_State *L,
145145
146146 dd ("XXX cache key: [%s]" , cache_key );
147147
148- rc = ngx_http_lua_cache_load_code (r , L , (char * ) cache_key );
148+ rc = ngx_http_lua_cache_load_code (log , L , (char * ) cache_key );
149149 if (rc == NGX_OK ) {
150150 /* code chunk loaded from cache, sp++ */
151151 dd ("Code cache hit! cache key='%s', stack top=%d, script='%.*s'" ,
@@ -194,15 +194,15 @@ ngx_http_lua_cache_loadbuffer(ngx_http_request_t *r, lua_State *L,
194194
195195error :
196196
197- ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
197+ ngx_log_error (NGX_LOG_ERR , log , 0 ,
198198 "failed to load inlined Lua code: %s" , err );
199199 lua_settop (L , n );
200200 return NGX_ERROR ;
201201}
202202
203203
204204ngx_int_t
205- ngx_http_lua_cache_loadfile (ngx_http_request_t * r , lua_State * L ,
205+ ngx_http_lua_cache_loadfile (ngx_log_t * log , lua_State * L ,
206206 const u_char * script , const u_char * cache_key )
207207{
208208 int n ;
@@ -229,7 +229,7 @@ ngx_http_lua_cache_loadfile(ngx_http_request_t *r, lua_State *L,
229229
230230 dd ("XXX cache key for file: [%s]" , cache_key );
231231
232- rc = ngx_http_lua_cache_load_code (r , L , (char * ) cache_key );
232+ rc = ngx_http_lua_cache_load_code (log , L , (char * ) cache_key );
233233 if (rc == NGX_OK ) {
234234 /* code chunk loaded from cache, sp++ */
235235 dd ("Code cache hit! cache key='%s', stack top=%d, file path='%s'" ,
@@ -286,7 +286,7 @@ ngx_http_lua_cache_loadfile(ngx_http_request_t *r, lua_State *L,
286286
287287error :
288288
289- ngx_log_error (NGX_LOG_ERR , r -> connection -> log , 0 ,
289+ ngx_log_error (NGX_LOG_ERR , log , 0 ,
290290 "failed to load external Lua file \"%s\": %s" , script , err );
291291
292292 lua_settop (L , n );
0 commit comments