summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorGreg Stein <gstein@apache.org>2000-07-08 11:31:49 +0000
committerGreg Stein <gstein@apache.org>2000-07-08 11:31:49 +0000
commit2fd470398905d8608c66171abbf87217a8ed26d7 (patch)
tree403986b3f158c7a4a22578129cc3ab8cccb2c609 /misc
parent60a6a5e0a3dbaae290764674f4cc604237dacee4 (diff)
downloadapr-2fd470398905d8608c66171abbf87217a8ed26d7.tar.gz
a while back, we said "segfault on invalid params rather than returning an
error." this removes some of the error checking that was occurring in the "user data" functions. also saw some in the "get/set OS type" functions and nuked those; there are still checks for pool==NULL, though, since that would end up making us malloc() rather than segfault'ing. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@60318 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc')
-rw-r--r--misc/unix/start.c98
1 files changed, 46 insertions, 52 deletions
diff --git a/misc/unix/start.c b/misc/unix/start.c
index 18a3f2342..ab8ee4d3d 100644
--- a/misc/unix/start.c
+++ b/misc/unix/start.c
@@ -57,23 +57,23 @@
ap_status_t ap_create_pool(ap_pool_t **newcont, ap_pool_t *cont)
{
- ap_pool_t *new;
+ ap_pool_t *newpool;
if (cont) {
- new = ap_make_sub_pool(cont, cont->apr_abort);
+ newpool = ap_make_sub_pool(cont, cont->apr_abort);
}
else {
- new = ap_make_sub_pool(NULL, NULL);
+ newpool = ap_make_sub_pool(NULL, NULL);
}
- if (new == NULL) {
+ if (newpool == NULL) {
return APR_ENOPOOL;
}
- new->prog_data = NULL;
- new->apr_abort = NULL;
+ newpool->prog_data = NULL;
+ newpool->apr_abort = NULL;
- *newcont = new;
+ *newcont = newpool;
return APR_SUCCESS;
}
@@ -82,53 +82,53 @@ ap_status_t ap_set_userdata(void *data, const char *key,
ap_pool_t *cont)
{
datastruct *dptr = NULL, *dptr2 = NULL;
- if (cont) {
- dptr = cont->prog_data;
- while (dptr) {
- if (!strcmp(dptr->key, key))
- break;
- dptr2 = dptr;
- dptr = dptr->next;
+
+ /* ### replace with an ap_hash_t */
+
+ dptr = cont->prog_data;
+ while (dptr) {
+ if (!strcmp(dptr->key, key))
+ break;
+ dptr2 = dptr;
+ dptr = dptr->next;
+ }
+ if (dptr == NULL) {
+ dptr = ap_pcalloc(cont, sizeof(datastruct));
+ dptr->next = dptr->prev = NULL;
+ dptr->key = ap_pstrdup(cont, key);
+ if (dptr2) {
+ dptr2->next = dptr;
+ dptr->prev = dptr2;
}
- if (dptr == NULL) {
- dptr = ap_pcalloc(cont, sizeof(datastruct));
- dptr->next = dptr->prev = NULL;
- dptr->key = ap_pstrdup(cont, key);
- if (dptr2) {
- dptr2->next = dptr;
- dptr->prev = dptr2;
- }
- else {
- cont->prog_data = dptr;
- }
+ else {
+ cont->prog_data = dptr;
}
- dptr->data = data;
- ap_register_cleanup(cont, dptr->data, cleanup, cleanup);
- return APR_SUCCESS;
}
- return APR_ENOPOOL;
+ dptr->data = data;
+ ap_register_cleanup(cont, dptr->data, cleanup, cleanup);
+ return APR_SUCCESS;
}
ap_status_t ap_get_userdata(void **data, const char *key, ap_pool_t *cont)
{
datastruct *dptr = NULL;
- if (cont) {
- dptr = cont->prog_data;
- while (dptr) {
- if (!strcmp(dptr->key, key)) {
- break;
- }
- dptr = dptr->next;
- }
- if (dptr) {
- (*data) = dptr->data;
- }
- else {
- (*data) = NULL;
+
+ /* ### replace with an ap_hash_t */
+
+ dptr = cont->prog_data;
+ while (dptr) {
+ if (!strcmp(dptr->key, key)) {
+ break;
}
- return APR_SUCCESS;
+ dptr = dptr->next;
}
- return APR_ENOPOOL;
+ if (dptr) {
+ (*data) = dptr->data;
+ }
+ else {
+ (*data) = NULL;
+ }
+ return APR_SUCCESS;
}
ap_status_t ap_initialize(void)
@@ -163,12 +163,6 @@ void ap_terminate(void)
ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_pool_t *cont)
{
- if (cont == NULL) {
- return APR_ENOPOOL;
- }
- else {
- cont->apr_abort = apr_abort;
- return APR_SUCCESS;
- }
+ cont->apr_abort = apr_abort;
+ return APR_SUCCESS;
}
-