diff --git a/include/lighttpd/plugin.h b/include/lighttpd/plugin.h index f39bafe..d22bc0b 100644 --- a/include/lighttpd/plugin.h +++ b/include/lighttpd/plugin.h @@ -28,7 +28,7 @@ struct liPlugin { gpointer data; /**< private plugin data */ - size_t opt_base_index; + size_t opt_base_index, optptr_base_index; gboolean ready_for_next_state; /**< don't modify this; use li_plugin_ready_for_state() instead */ @@ -190,7 +190,7 @@ extern liOptionPtrValue li_option_ptr_zero; #define _OPTION(vr, p, idx) (vr->options[p->opt_base_index + idx]) #define _OPTION_ABS(vr, idx) (vr->options[idx]) #define OPTIONPTR(idx) _OPTIONPTR(vr, p, idx) -#define _OPTIONPTR(vr, p, idx) (vr->optionptrs[p->opt_base_index + idx] ? vr->optionptrs[p->opt_base_index + idx]->data : li_option_ptr_zero.data) +#define _OPTIONPTR(vr, p, idx) (vr->optionptrs[p->optptr_base_index + idx] ? vr->optionptrs[p->optptr_base_index + idx]->data : li_option_ptr_zero.data) #define _OPTIONPTR_ABS(vr, idx) (vr->optionptrs[idx] ? vr->optionptrs[idx]->data : li_option_ptr_zero.data) #endif diff --git a/src/main/plugin.c b/src/main/plugin.c index c0fe9a4..403f3bf 100644 --- a/src/main/plugin.c +++ b/src/main/plugin.c @@ -136,6 +136,7 @@ liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB in init(srv, p, userdata); p->opt_base_index = g_hash_table_size(srv->options); + p->optptr_base_index = g_hash_table_size(srv->optionptrs); if (p->options) { size_t i; diff --git a/src/modules/mod_fastcgi.c b/src/modules/mod_fastcgi.c index 5a6b074..a01f2bd 100644 --- a/src/modules/mod_fastcgi.c +++ b/src/modules/mod_fastcgi.c @@ -32,10 +32,6 @@ enum fastcgi_options_t { FASTCGI_OPTION_LOG_PLAIN_ERRORS = 0, }; -#define FASTCGI_OPTION(idx) _FASTCGI_OPTION(vr, idx) -#define _FASTCGI_OPTION(vr, idx) _OPTION_ABS(vr, p->opt_base_index + idx) - - LI_API gboolean mod_fastcgi_init(liModules *mods, liModule *mod); LI_API gboolean mod_fastcgi_free(liModules *mods, liModule *mod); @@ -531,7 +527,7 @@ static gboolean fastcgi_parse_response(fastcgi_connection *fcon) { case FCGI_STDERR: len = fastcgi_available(fcon); li_chunkqueue_extract_to(vr, fcon->fcgi_in, len, vr->wrk->tmp_str); - if (FASTCGI_OPTION(FASTCGI_OPTION_LOG_PLAIN_ERRORS).boolean) { + if (OPTION(FASTCGI_OPTION_LOG_PLAIN_ERRORS).boolean) { li_log_split_lines(vr->wrk->srv, vr, LI_LOG_LEVEL_BACKEND, 0, vr->wrk->tmp_str->str, ""); } else { VR_BACKEND_LINES(vr, vr->wrk->tmp_str->str, "(fcgi-stderr %s) ", fcon->ctx->socket_str->str);