[core] store (plugin *) in p->data

(self-referential)
This commit is contained in:
Glenn Strauss 2020-01-10 23:12:08 -05:00
parent aca9d45adf
commit eea7cd3c2f
3 changed files with 8 additions and 4 deletions

View File

@ -9,6 +9,9 @@ typedef struct server server;
struct connection;
typedef struct connection connection;
struct plugin;
typedef struct plugin plugin;
struct request_st;
typedef struct request_st request_st;

View File

@ -435,7 +435,7 @@ handler_t plugins_call_init(server *srv) {
return HANDLER_ERROR;
}
/* used for con->mode, DIRECT == 0, plugins above that */
((plugin_data_base *)(p->data))->self = p;
((plugin_data_base *)(p->data))->id = i + 1;
if (p->version != LIGHTTPD_VERSION_ID) {

View File

@ -49,13 +49,14 @@ extern array plugin_stats;
#define PLUGIN_DATA int id; \
int nconfig; \
config_plugin_value_t *cvlist
config_plugin_value_t *cvlist; \
struct plugin *self
typedef struct {
PLUGIN_DATA;
} plugin_data_base;
typedef struct {
struct plugin {
void *data;
/* is called ... */
handler_t (* handle_uri_raw) (connection *con, void *p_d); /* after uri_raw is set */
@ -85,7 +86,7 @@ typedef struct {
const char *name;/* name of the plugin */
size_t version;
void *lib; /* dlopen handle */
} plugin;
};
__attribute_cold__
int plugins_load(server *srv);