From: Ryan Bloom Date: Tue, 14 Sep 1999 13:37:45 +0000 (+0000) Subject: A change to how APR uses user data. Now, user data is a linked list that X-Git-Tag: 1.3.10~323 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e4e32bb59ede3d241c6a6109612de5f6fbefb1d2;p=apache A change to how APR uses user data. Now, user data is a linked list that is retreivable using a char string. Basically, you provide a string that will be used as a key when you store the data. If the key was used before, we will overwrite the old data. When you want to retreive your data, pass in the same key, and we will find the data you care about. This also makes it harder to put user data in when creating a context, so that option has disappeared. It is also impossible to inherit user data from parent contexts. This option may be added in later. I will be documenting this VERY soon. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83901 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/aaa/mod_auth.c b/modules/aaa/mod_auth.c index 163d4a226f..749060916f 100644 --- a/modules/aaa/mod_auth.c +++ b/modules/aaa/mod_auth.c @@ -157,7 +157,7 @@ static ap_table_t *groups_for_user(ap_context_t *p, char *user, char *grpfile) return NULL; } - ap_create_context(p, NULL, &sp); + ap_create_context(p, &sp); while (!(ap_cfg_getline(l, MAX_STRING_LEN, f))) { if ((l[0] == '#') || (!l[0])) diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index cdf47e1ed1..3909bd4125 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -1280,7 +1280,7 @@ static void output_directories(struct ent **ar, int n, char *name_scratch; char *pad_scratch; - ap_create_context(r->pool, NULL, &scratch); + ap_create_context(r->pool, &scratch); if (name[0] == '\0') { name = "/"; } diff --git a/modules/http/http_core.c b/modules/http/http_core.c index 3a33543ae4..d39fd71ea6 100644 --- a/modules/http/http_core.c +++ b/modules/http/http_core.c @@ -399,7 +399,7 @@ void ap_core_reorder_directories(ap_context_t *p, server_rec *s) elts = (void **)sec->elts; /* we have to allocate tmp space to do a stable sort */ - ap_create_context(p, NULL, &tmp); + ap_create_context(p, &tmp); sortbin = ap_palloc(tmp, sec->nelts * sizeof(*sortbin)); for (i = 0; i < nelts; ++i) { sortbin[i].orig_index = i; diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index c099254318..99f5d800a9 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -927,7 +927,7 @@ request_rec *ap_read_request(conn_rec *conn) const char *expect; int access_status; - ap_create_context(conn->pool, NULL, &p); + ap_create_context(conn->pool, &p); r = ap_pcalloc(p, sizeof(request_rec)); r->pool = p; r->connection = conn; diff --git a/modules/http/http_request.c b/modules/http/http_request.c index 8e8b455225..684ad983e7 100644 --- a/modules/http/http_request.c +++ b/modules/http/http_request.c @@ -740,7 +740,7 @@ static request_rec *make_sub_request(const request_rec *r) ap_context_t *rrp; request_rec *rr; - ap_create_context(r->pool, NULL, &rrp); + ap_create_context(r->pool, &rrp); rr = ap_pcalloc(rrp, sizeof(request_rec)); rr->pool = rrp; return rr; diff --git a/server/main.c b/server/main.c index de68c51261..87981a831a 100644 --- a/server/main.c +++ b/server/main.c @@ -267,10 +267,10 @@ int main(int argc, char **argv) ap_util_init(); ap_util_uri_init(); - ap_create_context(NULL, NULL, &pglobal); + ap_create_context(NULL, &pglobal); g_pHookPool=pglobal; - ap_create_context(pglobal, NULL, &pcommands); + ap_create_context(pglobal, &pcommands); ap_server_pre_read_config = ap_make_array(pcommands, 1, sizeof(char *)); ap_server_post_read_config = ap_make_array(pcommands, 1, sizeof(char *)); ap_server_config_defines = ap_make_array(pcommands, 1, sizeof(char *)); @@ -317,9 +317,9 @@ int main(int argc, char **argv) } } - ap_create_context(pglobal, NULL, &pconf); - ap_create_context(pglobal, NULL, &plog); - ap_create_context(pconf, NULL, &ptemp); + ap_create_context(pglobal, &pconf); + ap_create_context(pglobal, &plog); + ap_create_context(pconf, &ptemp); /* for legacy reasons, we read the configuration twice before we actually serve any requests */ @@ -340,7 +340,7 @@ int main(int argc, char **argv) for (;;) { ap_clear_pool(pconf); - ap_create_context(pconf, NULL, &ptemp); + ap_create_context(pconf, &ptemp); ap_server_root = def_server_root; ap_run_pre_config(pconf, plog, ptemp); server_conf = ap_read_config(pconf, ptemp, confname); diff --git a/server/mpm/dexter/dexter.c b/server/mpm/dexter/dexter.c index ae65437573..82e72637ca 100644 --- a/server/mpm/dexter/dexter.c +++ b/server/mpm/dexter/dexter.c @@ -858,9 +858,9 @@ static void *worker_thread(void *arg) int native_socket; pthread_mutex_lock(&thread_pool_create_mutex); - ap_create_context(thread_pool_parent, NULL, &tpool); + ap_create_context(thread_pool_parent, &tpool); pthread_mutex_unlock(&thread_pool_create_mutex); - ap_create_context(tpool, NULL, &ptrans); + ap_create_context(tpool, &ptrans); while (!workers_may_exit) { workers_may_exit |= (max_requests_per_child != 0) && (requests_this_child <= 0); @@ -981,7 +981,7 @@ static void child_main(int child_num_arg) my_pid = getpid(); child_num = child_num_arg; - ap_create_context(pconf, NULL, &pchild); + ap_create_context(pconf, &pchild); /*stuff to do before we switch id's, so we have permissions.*/ @@ -1026,7 +1026,7 @@ static void child_main(int child_num_arg) for (i = 0; i < max_threads; i++) { worker_thread_free_ids[i] = i; } - ap_create_context(pchild, NULL, &thread_pool_parent); + ap_create_context(pchild, &thread_pool_parent); pthread_mutex_init(&thread_pool_create_mutex, NULL); pthread_mutex_init(&idle_thread_count_mutex, NULL); pthread_mutex_init(&worker_thread_count_mutex, NULL); diff --git a/server/mpm/mpmt_pthread/mpmt_pthread.c b/server/mpm/mpmt_pthread/mpmt_pthread.c index 420549381b..908cf02e51 100644 --- a/server/mpm/mpmt_pthread/mpmt_pthread.c +++ b/server/mpm/mpmt_pthread/mpmt_pthread.c @@ -809,7 +809,7 @@ static void * worker_thread(void * dummy) free(ti); - ap_create_context(tpool, NULL, &ptrans); + ap_create_context(tpool, &ptrans); pthread_mutex_lock(&worker_thread_count_mutex); worker_thread_count++; @@ -918,7 +918,7 @@ static void child_main(int child_num_arg) ap_listen_rec *lr; my_pid = getpid(); - ap_create_context(pconf, NULL, &pchild); + ap_create_context(pconf, &pchild); /*stuff to do before we switch id's, so we have permissions.*/ reopen_scoreboard(pchild); @@ -972,7 +972,7 @@ static void child_main(int child_num_arg) my_info->pid = my_child_num; my_info->tid = i; my_info->sd = 0; - ap_create_context(pchild, NULL, &my_info->tpool); + ap_create_context(pchild, &my_info->tpool); /* We are creating threads right now */ (void) ap_update_child_status(my_child_num, i, SERVER_STARTING, diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index a1fa75851c..043eb15f30 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -1957,9 +1957,9 @@ static void child_main(int child_num_arg) /* Get a sub ap_context_t for global allocations in this child, so that * we can have cleanups occur when the child exits. */ - ap_create_context(pconf, NULL, &pchild); + ap_create_context(pconf, &pchild); - ap_create_context(pchild, NULL, &ptrans); + ap_create_context(pchild, &ptrans); /* needs to be done before we switch UIDs so we have permissions */ reopen_scoreboard(pchild);