Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 65000 invoked by uid 500); 19 May 2001 22:47:32 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 64981 invoked by uid 1103); 19 May 2001 22:47:31 -0000 Date: 19 May 2001 22:47:31 -0000 Message-ID: <20010519224731.64976.qmail@apache.org> From: dreid@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/memory/unix apr_sms.c dreid 01/05/19 15:47:31 Modified: include apr_errno.h apr_sms.h misc/unix errorcodes.c memory/unix apr_sms.c Log: Some more tidying up. - remove the declarations from apr_sms.h for the old lock/unlock definitions as apr_sms.c has been updated to use the new simpler definitions. Noticed by Justin/Cliff/Ben... - in apr_sms_destroy simplify the logic of if...else if to simple if statements as we'll never move on if a check is true Suggested by Sander Striker - remove the APR_EMEMFUNC definition and replace it with the existing APR_ENITIMPL value. Suggested by Cliff Woolley - I'm leaving the EMEMSYS as it conveys more information than if we simply return with EINVAL. Revision Changes Path 1.64 +0 -2 apr/include/apr_errno.h Index: apr_errno.h =================================================================== RCS file: /home/cvs/apr/include/apr_errno.h,v retrieving revision 1.63 retrieving revision 1.64 diff -u -r1.63 -r1.64 --- apr_errno.h 2001/05/19 13:53:06 1.63 +++ apr_errno.h 2001/05/19 22:47:28 1.64 @@ -255,7 +255,6 @@ #define APR_EBADPATH (APR_OS_START_ERROR + 24) #define APR_ENOCLEANUP (APR_OS_START_ERROR + 25) #define APR_EMEMSYS (APR_OS_START_ERROR + 26) -#define APR_EMEMFUNC (APR_OS_START_ERROR + 27) /* APR ERROR VALUE TESTS */ #define APR_STATUS_IS_ENOSTAT(s) ((s) == APR_ENOSTAT) @@ -284,7 +283,6 @@ #define APR_STATUS_IS_EBADPATH(s) ((s) == APR_EBADPATH) #define APR_STATUS_IS_ENOCLEANUP(s) ((s) == APR_ENOCLEANUP) #define APR_STATUS_IS_EMEMSYS(s) ((s) == APR_EMEMSYS) -#define APR_STATUS_IS_EMEMFUNC(s) ((s) == APR_EMEMFUNC) /* APR STATUS VALUES */ #define APR_INCHILD (APR_OS_START_STATUS + 1) 1.4 +1 -4 apr/include/apr_sms.h Index: apr_sms.h =================================================================== RCS file: /home/cvs/apr/include/apr_sms.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- apr_sms.h 2001/05/19 15:35:44 1.3 +++ apr_sms.h 2001/05/19 22:47:29 1.4 @@ -224,7 +224,7 @@ * @param mem_sys The memory system to be released from thread-safety * @deffunc void apr_sms_unlock(apr_sms_t *mem_sys) */ -APR_DECLARE(apr_status_t) apr_sms__unlock(apr_sms_t *mem_sys); +APR_DECLARE(apr_status_t) apr_sms_unlock(apr_sms_t *mem_sys); /** * Determine if memory system a is an ancestor of memory system b @@ -311,9 +311,6 @@ * @deffunc apr_status_t apr_sms_std_create(apr_sms_t **mem_sys); */ APR_DECLARE(apr_status_t) apr_sms_std_create(apr_sms_t **mem_sys); - -APR_DECLARE(apr_status_t) apr_sms_threadsafe_lock(apr_sms_t *mem_sys); -APR_DECLARE(apr_status_t) apr_sms_threadsafe_unlock(apr_sms_t *mem_sys); #ifdef __cplusplus } 1.38 +0 -3 apr/misc/unix/errorcodes.c Index: errorcodes.c =================================================================== RCS file: /home/cvs/apr/misc/unix/errorcodes.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -r1.37 -r1.38 --- errorcodes.c 2001/05/19 13:53:06 1.37 +++ errorcodes.c 2001/05/19 22:47:29 1.38 @@ -168,9 +168,6 @@ return "The given path misformatted or contained invalid characters"; case APR_EMEMSYS: return "The memory system passed does not exist"; - case APR_EMEMFUNC: - return "The function requested is not available in the memory " - "system used"; case APR_ENOCLEANUP: return "The requested cleanup function does not exist"; default: 1.6 +17 -16 apr/memory/unix/apr_sms.c Index: apr_sms.c =================================================================== RCS file: /home/cvs/apr/memory/unix/apr_sms.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- apr_sms.c 2001/05/19 21:55:43 1.5 +++ apr_sms.c 2001/05/19 22:47:30 1.6 @@ -160,7 +160,7 @@ if (!mem_sys->free_fn) return mem_sys->free_fn(mem_sys, mem); - return APR_EMEMFUNC; + return APR_ENOTIMPL; } /* @@ -218,7 +218,7 @@ /* * A memory system without a malloc won't do us much good */ - assert(mem_sys->malloc_fn != NULL); + assert(mem_sys->malloc_fn); /* * Check to see if this is either a non-tracking or @@ -246,7 +246,7 @@ * tracking ancestors, but in that specific case we issue a * warning. */ - if (mem_sys->parent_mem_sys == NULL) + if (!mem_sys->parent_mem_sys) return; parent = mem_sys @@ -314,7 +314,7 @@ return APR_EMEMSYS; if (!mem_sys->reset_fn) - return APR_EMEMFUNC; + return APR_ENOTIMPL; /* * Run the cleanups of all child memory systems _including_ @@ -383,6 +383,7 @@ /* Visit all children and destroy them */ child_mem_sys = mem_sys->child_mem_sys; + while (child_mem_sys != NULL){ sibling_mem_sys = child_mem_sys->sibling_mem_sys; apr_sms_destroy(child_mem_sys); @@ -413,6 +414,7 @@ { /* Run all cleanups, free'ing memory as we go */ cleanup = mem_sys->cleanups; + while (cleanup){ cleanup->cleanup_fn(cleanup->data); next_cleanup = cleanup->next; @@ -449,11 +451,11 @@ return mem_sys->destroy_fn(mem_sys); /* 2 - If we don't have a parent, free using ourselves */ - else if (!mem_sys->parent_mem_sys) + if (!mem_sys->parent_mem_sys) return mem_sys->free_fn(mem_sys, mem_sys); /* 3 - If we do have a parent and it has a free function, use it */ - else if (mem_sys->parent_mem_sys->free_fn) + if (mem_sys->parent_mem_sys->free_fn) return apr_sms_free(mem_sys->parent_mem_sys, mem_sys); /* 4 - Assume we are the child of a tracking memory system, and do nothing */ @@ -477,8 +479,7 @@ return APR_EMEMSYS; #ifdef APR_ASSERT_MEMORY - assert(a != NULL); - assert(b != NULL); + assert(a); #endif while (b && b != a) @@ -488,13 +489,13 @@ return !(b == a); } -APR_DECLARE(apr_status_t) apr_sms_threadsafe_lock(apr_sms_t *mem_sys) +APR_DECLARE(apr_status_t) apr_sms_lock(apr_sms_t *mem_sys) { if (!mem_sys) return APR_EMEMSYS; if (!mem_sys->lock_fn) - return APR_EMEMFUNC; + return APR_ENOTIMPL; if (mem_sys->lock_fn) return mem_sys->lock_fn(mem_sys); @@ -502,13 +503,13 @@ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_sms_threadsafe_unlock(apr_sms_t *mem_sys) +APR_DECLARE(apr_status_t) apr_sms_unlock(apr_sms_t *mem_sys) { if (!mem_sys) return APR_EMEMSYS; if (!mem_sys->unlock_fn) - return APR_EMEMFUNC; + return APR_ENOTIMPL; if (mem_sys->unlock_fn) return mem_sys->unlock_fn(mem_sys); @@ -534,7 +535,7 @@ #endif if (!cleanup_fn) - return APR_EMEMFUNC; + return APR_ENOTIMPL; cleanup = (struct apr_sms_cleanup *) apr_sms_malloc(mem_sys->accounting_mem_sys, sizeof(struct apr_sms_cleanup)); @@ -551,9 +552,9 @@ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) -apr_sms_cleanup_unregister(apr_sms_t *mem_sys, apr_int32_t type, void *data, - apr_status_t (*cleanup_fn)(void *)) +APR_DECLARE(apr_status_t) apr_sms_cleanup_unregister(apr_sms_t *mem_sys, apr_int32_t type, + void *data, + apr_status_t (*cleanup_fn)(void *)) { struct apr_sms_cleanup *cleanup; struct apr_sms_cleanup **cleanup_ref;