httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r729308 - in /httpd/httpd/trunk/modules/mem: mod_plainmem.c mod_sharedmem.c sharedmem_util.c
Date Wed, 24 Dec 2008 13:04:35 GMT
Author: jim
Date: Wed Dec 24 05:04:34 2008
New Revision: 729308

URL: http://svn.apache.org/viewvc?rev=729308&view=rev
Log:
style changes only

Modified:
    httpd/httpd/trunk/modules/mem/mod_plainmem.c
    httpd/httpd/trunk/modules/mem/mod_sharedmem.c
    httpd/httpd/trunk/modules/mem/sharedmem_util.c

Modified: httpd/httpd/trunk/modules/mem/mod_plainmem.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/mod_plainmem.c?rev=729308&r1=729307&r2=729308&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mem/mod_plainmem.c (original)
+++ httpd/httpd/trunk/modules/mem/mod_plainmem.c Wed Dec 24 05:04:34 2008
@@ -46,12 +46,12 @@
     void *ptr;
 
     if (!mem)
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
 
     ptr = mem->base;
     for (i = 0; i < mem->num; i++) {
-        ptr = ptr + mem->size;
-        func((void *)ptr, data, pool);
+	ptr = ptr + mem->size;
+	func((void *) ptr, data, pool);
     }
     return 0;
 }
@@ -64,42 +64,43 @@
     apr_status_t rv;
 
     if (name) {
-        if (name[0] == ':')
-            fname = name;
-        else
-            fname = ap_server_root_relative(pool, name);
-
-        /* first try to attach to existing slotmem */
-        if (next) {
-            for (;;) {
-                if (strcmp(next->name, fname) == 0) {
-                    /* we already have it */
-                    *new = next;
-                    return APR_SUCCESS;
-                }
-                if (!next->next)
-                    break;
-                next = next->next;
-            }
-        }
-    } else
-        fname = "anonymous";
+	if (name[0] == ':')
+	    fname = name;
+	else
+	    fname = ap_server_root_relative(pool, name);
+
+	/* first try to attach to existing slotmem */
+	if (next) {
+	    for (;;) {
+		if (strcmp(next->name, fname) == 0) {
+		    /* we already have it */
+		    *new = next;
+		    return APR_SUCCESS;
+		}
+		if (!next->next)
+		    break;
+		next = next->next;
+	    }
+	}
+    }
+    else
+	fname = "anonymous";
 
     /* create the memory using the globalpool */
     res = (ap_slotmem_t *) apr_pcalloc(globalpool, sizeof(ap_slotmem_t));
-    res->base =  apr_pcalloc(globalpool, item_size * item_num);
+    res->base = apr_pcalloc(globalpool, item_size * item_num);
     if (!res->base)
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
 
     /* For the chained slotmem stuff */
     res->name = apr_pstrdup(globalpool, fname);
     res->size = item_size;
     res->num = item_num;
     res->next = NULL;
-    if (globallistmem==NULL)
-        globallistmem = res;
+    if (globallistmem == NULL)
+	globallistmem = res;
     else
-        next->next = res;
+	next->next = res;
 
     *new = res;
     return APR_SUCCESS;
@@ -114,45 +115,46 @@
     apr_status_t rv;
 
     if (name) {
-        if (name[0] == ':')
-            fname = name;
-        else
-            fname = ap_server_root_relative(pool, name);
-    } else
-        return APR_ENOSHMAVAIL;
+	if (name[0] == ':')
+	    fname = name;
+	else
+	    fname = ap_server_root_relative(pool, name);
+    }
+    else
+	return APR_ENOSHMAVAIL;
 
     /* first try to attach to existing slotmem */
     if (next) {
-        for (;;) {
-            if (strcmp(next->name, fname) == 0) {
-                /* we already have it */
-                *new = next;
-                *item_size = next->size;
-                *item_num = next->num;
-                return APR_SUCCESS;
-            }
-            if (!next->next)
-                break;
-            next = next->next;
-        }
+	for (;;) {
+	    if (strcmp(next->name, fname) == 0) {
+		/* we already have it */
+		*new = next;
+		*item_size = next->size;
+		*item_num = next->num;
+		return APR_SUCCESS;
+	    }
+	    if (!next->next)
+		break;
+	    next = next->next;
+	}
     }
 
     return APR_ENOSHMAVAIL;
 }
 
-static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
+static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void **mem)
 {
 
     void *ptr;
 
     if (!score)
-        return APR_ENOSHMAVAIL;
-    if (id<0 || id>score->num)
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
+    if (id < 0 || id > score->num)
+	return APR_ENOSHMAVAIL;
 
     ptr = score->base + score->size * id;
     if (!ptr)
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
     *mem = ptr;
     return APR_SUCCESS;
 }
@@ -165,7 +167,7 @@
 };
 
 static int pre_config(apr_pool_t *p, apr_pool_t *plog,
-                             apr_pool_t *ptemp)
+		          apr_pool_t *ptemp)
 {
     globalpool = p;
     return OK;
@@ -179,10 +181,10 @@
 
 module AP_MODULE_DECLARE_DATA plainmem_module = {
     STANDARD20_MODULE_STUFF,
-    NULL,       /* create per-directory config structure */
-    NULL,       /* merge per-directory config structures */
-    NULL,       /* create per-server config structure */
-    NULL,       /* merge per-server config structures */
-    NULL,       /* command apr_table_t */
-    ap_plainmem_register_hook /* register hooks */
+    NULL,			/* create per-directory config structure */
+    NULL,			/* merge per-directory config structures */
+    NULL,			/* create per-server config structure */
+    NULL,			/* merge per-server config structures */
+    NULL,			/* command apr_table_t */
+    ap_plainmem_register_hook	/* register hooks */
 };

Modified: httpd/httpd/trunk/modules/mem/mod_sharedmem.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/mod_sharedmem.c?rev=729308&r1=729307&r2=729308&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mem/mod_sharedmem.c (original)
+++ httpd/httpd/trunk/modules/mem/mod_sharedmem.c Wed Dec 24 05:04:34 2008
@@ -38,16 +38,16 @@
 }
 
 static int pre_config(apr_pool_t *p, apr_pool_t *plog,
-                             apr_pool_t *ptemp)
+		          apr_pool_t *ptemp)
 {
     apr_pool_t *global_pool;
     apr_status_t rv;
 
     rv = apr_pool_create(&global_pool, NULL);
     if (rv != APR_SUCCESS) {
-        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
-                     "Fatal error: unable to create global pool for shared slotmem");
-        return rv;
+	ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
+	    "Fatal error: unable to create global pool for shared slotmem");
+	return rv;
     }
     sharedmem_initglobalpool(global_pool);
     return OK;
@@ -63,10 +63,10 @@
 
 module AP_MODULE_DECLARE_DATA sharedmem_module = {
     STANDARD20_MODULE_STUFF,
-    NULL,       /* create per-directory config structure */
-    NULL,       /* merge per-directory config structures */
-    NULL,       /* create per-server config structure */
-    NULL,       /* merge per-server config structures */
-    NULL,       /* command apr_table_t */
-    ap_sharedmem_register_hook /* register hooks */
+    NULL,			/* create per-directory config structure */
+    NULL,			/* merge per-directory config structures */
+    NULL,			/* create per-server config structure */
+    NULL,			/* merge per-server config structures */
+    NULL,			/* command apr_table_t */
+    ap_sharedmem_register_hook	/* register hooks */
 };

Modified: httpd/httpd/trunk/modules/mem/sharedmem_util.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mem/sharedmem_util.c?rev=729308&r1=729307&r2=729308&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/mem/sharedmem_util.c (original)
+++ httpd/httpd/trunk/modules/mem/sharedmem_util.c Wed Dec 24 05:04:34 2008
@@ -65,16 +65,16 @@
     const char *storename;
     const char *fname;
     if (strcmp(slotmemname, "anonymous") == 0)
-        fname = ap_server_root_relative(pool, "logs/anonymous");
+	fname = ap_server_root_relative(pool, "logs/anonymous");
     else if (slotmemname[0] == ':') {
-        const char *tmpname;
-        tmpname = apr_pstrcat(pool, "logs/", &slotmemname[1], NULL);
-        fname = ap_server_root_relative(pool, tmpname);
+	const char *tmpname;
+	tmpname = apr_pstrcat(pool, "logs/", &slotmemname[1], NULL);
+	fname = ap_server_root_relative(pool, tmpname);
     }
     else {
-        fname = slotmemname;
+	fname = slotmemname;
     }
-    storename = apr_pstrcat(pool, fname , ".slotmem", NULL); 
+    storename = apr_pstrcat(pool, fname, ".slotmem", NULL);
     return storename;
 }
 static void store_slotmem(ap_slotmem_t *slotmem)
@@ -86,13 +86,13 @@
 
     storename = store_filename(slotmem->globalpool, slotmem->name);
 
-    rv = apr_file_open(&fp, storename,  APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT,
slotmem->globalpool);
+    rv = apr_file_open(&fp, storename, APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT,
slotmem->globalpool);
     if (APR_STATUS_IS_EEXIST(rv)) {
-        apr_file_remove(storename, slotmem->globalpool);
-        rv = apr_file_open(&fp, storename,  APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT,
slotmem->globalpool);
+	apr_file_remove(storename, slotmem->globalpool);
+	rv = apr_file_open(&fp, storename, APR_CREATE | APR_READ | APR_WRITE, APR_OS_DEFAULT,
slotmem->globalpool);
     }
     if (rv != APR_SUCCESS) {
-        return;
+	return;
     }
     nbytes = slotmem->size * slotmem->num;
     apr_file_write(fp, slotmem->base, &nbytes);
@@ -107,20 +107,20 @@
     apr_status_t rv;
 
     storename = store_filename(pool, name);
-    rv = apr_file_open(&fp, storename,  APR_READ | APR_WRITE, APR_OS_DEFAULT, pool);
+    rv = apr_file_open(&fp, storename, APR_READ | APR_WRITE, APR_OS_DEFAULT, pool);
     if (rv == APR_SUCCESS) {
-        apr_finfo_t fi;
-        if (apr_file_info_get(&fi, APR_FINFO_SIZE, fp) == APR_SUCCESS) {
-            if (fi.size == nbytes) {
-                apr_file_read(fp, ptr, &nbytes);
-            }
-            else {
-                apr_file_close(fp);
-                apr_file_remove(storename, pool);
-                return;
-            }
-        }
-        apr_file_close(fp);
+	apr_finfo_t fi;
+	if (apr_file_info_get(&fi, APR_FINFO_SIZE, fp) == APR_SUCCESS) {
+	    if (fi.size == nbytes) {
+		apr_file_read(fp, ptr, &nbytes);
+	    }
+	    else {
+		apr_file_close(fp);
+		apr_file_remove(storename, pool);
+		return;
+	    }
+	}
+	apr_file_close(fp);
     }
 }
 
@@ -131,14 +131,14 @@
     apr_pool_t *pool = NULL;
 
     if (*mem) {
-        ap_slotmem_t *next = *mem;
-        pool = next->globalpool;
-        while (next) {
-            store_slotmem(next);
-            rv = apr_shm_destroy(next->shm);
-            next = next->next;
-        }
-        apr_pool_destroy(pool);        
+	ap_slotmem_t *next = *mem;
+	pool = next->globalpool;
+	while (next) {
+	    store_slotmem(next);
+	    rv = apr_shm_destroy(next->shm);
+	    next = next->next;
+	}
+	apr_pool_destroy(pool);
     }
     return APR_SUCCESS;
 }
@@ -149,13 +149,13 @@
     void *ptr;
 
     if (!mem) {
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
     }
 
     ptr = mem->base;
     for (i = 0; i < mem->num; i++) {
-        ptr = ptr + mem->size;
-        func((void *)ptr, data, pool);
+	ptr = ptr + mem->size;
+	func((void *) ptr, data, pool);
     }
     return 0;
 }
@@ -170,76 +170,76 @@
     apr_status_t rv;
 
     if (globalpool == NULL)
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
     if (name) {
-        if (name[0] == ':') {
-            fname = name;
-        }
-        else {
-            fname = ap_server_root_relative(pool, name);
-        }
-
-        /* first try to attach to existing slotmem */
-        if (next) {
-            for (;;) {
-                if (strcmp(next->name, fname) == 0) {
-                    /* we already have it */
-                    *new = next;
-                    return APR_SUCCESS;
-                }
-                if (!next->next) {
-                    break;
-                }
-                next = next->next;
-            }
-        }
+	if (name[0] == ':') {
+	    fname = name;
+	}
+	else {
+	    fname = ap_server_root_relative(pool, name);
+	}
+
+	/* first try to attach to existing slotmem */
+	if (next) {
+	    for (;;) {
+		if (strcmp(next->name, fname) == 0) {
+		    /* we already have it */
+		    *new = next;
+		    return APR_SUCCESS;
+		}
+		if (!next->next) {
+		    break;
+		}
+		next = next->next;
+	    }
+	}
     }
     else {
-        fname = "anonymous";
+	fname = "anonymous";
     }
 
     /* first try to attach to existing shared memory */
     res = (ap_slotmem_t *) apr_pcalloc(globalpool, sizeof(ap_slotmem_t));
     if (name && name[0] != ':') {
-        rv = apr_shm_attach(&res->shm, fname, globalpool);
+	rv = apr_shm_attach(&res->shm, fname, globalpool);
     }
     else {
-        rv = APR_EINVAL;
+	rv = APR_EINVAL;
     }
     if (rv == APR_SUCCESS) {
-        /* check size */
-        if (apr_shm_size_get(res->shm) != item_size * item_num + sizeof(struct sharedslotdesc))
{
-            apr_shm_detach(res->shm);
-            res->shm = NULL;
-            return APR_EINVAL;
-        }
-        ptr = apr_shm_baseaddr_get(res->shm);
-        memcpy(&desc, ptr, sizeof(desc));
-        if ( desc.item_size != item_size || desc.item_num != item_num) {
-            apr_shm_detach(res->shm);
-            res->shm = NULL;
-            return APR_EINVAL;
-        }
-        ptr = ptr +  sizeof(desc);
-    }
-    else  {
-        if (name && name[0] != ':') {
-            apr_shm_remove(fname, globalpool);
-            rv = apr_shm_create(&res->shm, item_size * item_num + sizeof(struct sharedslotdesc),
fname, globalpool);
-        }
-        else {
-            rv = apr_shm_create(&res->shm, item_size * item_num + sizeof(struct sharedslotdesc),
NULL, globalpool);
-        }
-        if (rv != APR_SUCCESS) {
-            return rv;
-        }
-        ptr = apr_shm_baseaddr_get(res->shm);
-        desc.item_size = item_size;
-        desc.item_num = item_num;
-        memcpy(ptr, &desc, sizeof(desc));
-        ptr = ptr +  sizeof(desc);
-        memset(ptr, 0, item_size * item_num);
-        restore_slotmem(ptr, fname, item_size, item_num, pool);  
+	/* check size */
+	if (apr_shm_size_get(res->shm) != item_size * item_num + sizeof(struct sharedslotdesc))
{
+	    apr_shm_detach(res->shm);
+	    res->shm = NULL;
+	    return APR_EINVAL;
+	}
+	ptr = apr_shm_baseaddr_get(res->shm);
+	memcpy(&desc, ptr, sizeof(desc));
+	if (desc.item_size != item_size || desc.item_num != item_num) {
+	    apr_shm_detach(res->shm);
+	    res->shm = NULL;
+	    return APR_EINVAL;
+	}
+	ptr = ptr + sizeof(desc);
+    }
+    else {
+	if (name && name[0] != ':') {
+	    apr_shm_remove(fname, globalpool);
+	    rv = apr_shm_create(&res->shm, item_size * item_num + sizeof(struct sharedslotdesc),
fname, globalpool);
+	}
+	else {
+	    rv = apr_shm_create(&res->shm, item_size * item_num + sizeof(struct sharedslotdesc),
NULL, globalpool);
+	}
+	if (rv != APR_SUCCESS) {
+	    return rv;
+	}
+	ptr = apr_shm_baseaddr_get(res->shm);
+	desc.item_size = item_size;
+	desc.item_num = item_num;
+	memcpy(ptr, &desc, sizeof(desc));
+	ptr = ptr + sizeof(desc);
+	memset(ptr, 0, item_size * item_num);
+	restore_slotmem(ptr, fname, item_size, item_num, pool);
     }
 
     /* For the chained slotmem stuff */
@@ -249,11 +249,11 @@
     res->num = item_num;
     res->globalpool = globalpool;
     res->next = NULL;
-    if (globallistmem==NULL) {
-        globallistmem = res;
+    if (globallistmem == NULL) {
+	globallistmem = res;
     }
     else {
-        next->next = res;
+	next->next = res;
     }
 
     *new = res;
@@ -270,41 +270,41 @@
     apr_status_t rv;
 
     if (globalpool == NULL) {
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
     }
     if (name) {
-        if (name[0] == ':') {
-            fname = name;
-        }
-        else {
-            fname = ap_server_root_relative(pool, name);
-        }
+	if (name[0] == ':') {
+	    fname = name;
+	}
+	else {
+	    fname = ap_server_root_relative(pool, name);
+	}
     }
     else {
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
     }
 
     /* first try to attach to existing slotmem */
     if (next) {
-        for (;;) {
-            if (strcmp(next->name, fname) == 0) {
-                /* we already have it */
-                *new = next;
-                *item_size = next->size;
-                *item_num = next->num;
-                return APR_SUCCESS;
-            }
-            if (!next->next)
-                break;
-            next = next->next;
-        }
+	for (;;) {
+	    if (strcmp(next->name, fname) == 0) {
+		/* we already have it */
+		*new = next;
+		*item_size = next->size;
+		*item_num = next->num;
+		return APR_SUCCESS;
+	    }
+	    if (!next->next)
+		break;
+	    next = next->next;
+	}
     }
 
     /* first try to attach to existing shared memory */
     res = (ap_slotmem_t *) apr_pcalloc(globalpool, sizeof(ap_slotmem_t));
     rv = apr_shm_attach(&res->shm, fname, globalpool);
     if (rv != APR_SUCCESS) {
-        return rv;
+	return rv;
     }
 
     /* Read the description of the slotmem */
@@ -319,11 +319,11 @@
     res->num = desc.item_num;
     res->globalpool = globalpool;
     res->next = NULL;
-    if (globallistmem==NULL) {
-        globallistmem = res;
+    if (globallistmem == NULL) {
+	globallistmem = res;
     }
     else {
-        next->next = res;
+	next->next = res;
     }
 
     *new = res;
@@ -331,21 +331,21 @@
     *item_num = desc.item_num;
     return APR_SUCCESS;
 }
-static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void**mem)
+static apr_status_t ap_slotmem_mem(ap_slotmem_t *score, int id, void **mem)
 {
 
     void *ptr;
 
     if (!score) {
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
     }
-    if (id<0 || id>score->num) {
-        return APR_ENOSHMAVAIL;
+    if (id < 0 || id > score->num) {
+	return APR_ENOSHMAVAIL;
     }
 
     ptr = score->base + score->size * id;
     if (!ptr) {
-        return APR_ENOSHMAVAIL;
+	return APR_ENOSHMAVAIL;
     }
     ptr = score->base + score->size * id;
     *mem = ptr;
@@ -362,7 +362,7 @@
 /* make the storage usuable from outside */
 const slotmem_storage_method *sharedmem_getstorage(void)
 {
-    return(&storage);
+    return (&storage);
 }
 /* initialise the global pool */
 void sharedmem_initglobalpool(apr_pool_t *p)



Mime
View raw message