apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/locks/win32 locks.c
Date Tue, 05 Jun 2001 13:22:55 GMT
dreid       01/06/05 06:22:54

  Modified:    .        acconfig.h
               include  apr_lock.h
               include/arch/beos locks.h
               include/arch/os2 locks.h
               include/arch/unix locks.h
               include/arch/win32 locks.h
               locks/beos crossproc.c intraproc.c locks.c
               locks/os2 locks.c
               locks/unix crossproc.c locks.c
               locks/win32 locks.c
  Log:
  A couple of changes...
  
  - rename the CLEANUP macros so they make more sense (I hope)
  - cntxt -> pool in the lock code and macro's
  
  No functional change.
  
  Revision  Changes    Path
  1.44      +12 -12    apr/acconfig.h
  
  Index: acconfig.h
  ===================================================================
  RCS file: /home/cvs/apr/acconfig.h,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- acconfig.h	2001/06/05 08:15:01	1.43
  +++ acconfig.h	2001/06/05 13:21:52	1.44
  @@ -70,25 +70,25 @@
   /* Macros to deal with using either a pool or an sms
    * to do memory stuff...
    */
  -#define APR_REGISTER_CLEANUP(struct, data, func, scope) \
  -    if (struct->cntxt) { \
  -        apr_pool_cleanup_register(struct->cntxt, data, func, scope); \
  +#define APR_CLEANUP_REGISTER(struct, data, func, scope) \
  +    if (struct->pool) { \
  +        apr_pool_cleanup_register(struct->pool, data, func, scope); \
       } else { \
           apr_sms_cleanup_register(struct->mem_sys, APR_CHILD_CLEANUP, \
                                    data, func); \
       }
   
  -#define APR_REMOVE_CLEANUP(struct, data, func) \
  -    if (struct->cntxt) { \
  -        apr_pool_cleanup_kill(struct->cntxt, data, func); \
  +#define APR_CLEANUP_REMOVE(struct, data, func) \
  +    if (struct->pool) { \
  +        apr_pool_cleanup_kill(struct->pool, data, func); \
       } else { \
           apr_sms_cleanup_unregister(struct->mem_sys, APR_CHILD_CLEANUP, \
                                      data, func); \
       }
   
   #define APR_MEM_PSTRDUP(struct, ptr, str) \
  -    if (struct->cntxt) { \
  -        ptr = apr_pstrdup(struct->cntxt, str); \
  +    if (struct->pool) { \
  +        ptr = apr_pstrdup(struct->pool, str); \
       } else { \
           size_t len = strlen(str) + 1; \
           ptr = (char*) apr_sms_calloc(struct->mem_sys, len); \
  @@ -96,15 +96,15 @@
       }
   
   #define APR_MEM_MALLOC(ptr, struct, type) \
  -    if (struct->cntxt) { \
  -        ptr = (type *)apr_palloc(struct->cntxt, sizeof(type)); \
  +    if (struct->pool) { \
  +        ptr = (type *)apr_palloc(struct->pool, sizeof(type)); \
       } else { \
           ptr = (type *)apr_sms_malloc(struct->mem_sys, sizeof(type)); \
       }
   
   #define APR_MEM_CALLOC(ptr, struct, type) \
  -    if (struct->cntxt) { \
  -        ptr = (type *)apr_pcalloc(struct->cntxt, sizeof(type)); \
  +    if (struct->pool) { \
  +        ptr = (type *)apr_pcalloc(struct->pool, sizeof(type)); \
       } else { \
           ptr = (type *)apr_sms_calloc(struct->mem_sys, sizeof(type)); \
       }
  
  
  
  1.26      +6 -6      apr/include/apr_lock.h
  
  Index: apr_lock.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_lock.h,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- apr_lock.h	2001/06/05 08:15:07	1.25
  +++ apr_lock.h	2001/06/05 13:21:59	1.26
  @@ -94,16 +94,16 @@
    * @param fname A file name to use if the lock mechanism requires one.  This
    *        argument should always be provided.  The lock code itself will
    *        determine if it should be used.
  - * @param cont The pool to operate on.
  + * @param pool The pool to operate on.
    * @tip APR_CROSS_PROCESS may lock both processes and threads, but it is
    *      only guaranteed to lock processes.
  - * @deffunc apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, apr_lockscope_e
scope, const char *fname, apr_pool_t *cont)
  + * @deffunc apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, apr_lockscope_e
scope, const char *fname, apr_pool_t *pool)
    */
   APR_DECLARE(apr_status_t) apr_lock_create(apr_lock_t **lock,
                                             apr_locktype_e type,
                                             apr_lockscope_e scope,
                                             const char *fname,
  -                                          apr_pool_t *cont);
  +                                          apr_pool_t *pool);
   
   /**
    * Lock a protected region.
  @@ -144,16 +144,16 @@
    *              argument should always be provided.  The lock code itself will
    *              determine if it should be used.  This filename should be the 
    *              same one that was passed to apr_lock_create
  - * @param cont The pool to operate on.
  + * @param pool The pool to operate on.
    * @tip This function doesn't always do something, it depends on the
    *      locking mechanism chosen for the platform, but it is a good
    *      idea to call it regardless, because it makes the code more
    *      portable. 
  - * @deffunc apr_status_t apr_lock_child_init(apr_lock_t **lock, const char *fname, apr_pool_t
*cont)
  + * @deffunc apr_status_t apr_lock_child_init(apr_lock_t **lock, const char *fname, apr_pool_t
*pool)
    */
   APR_DECLARE(apr_status_t) apr_lock_child_init(apr_lock_t **lock,
                                                 const char *fname,
  -                                              apr_pool_t *cont);
  +                                              apr_pool_t *pool);
   
   /**
    * Return the pool associated with the current lock.
  
  
  
  1.14      +1 -1      apr/include/arch/beos/locks.h
  
  Index: locks.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/beos/locks.h,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- locks.h	2001/06/05 09:15:02	1.13
  +++ locks.h	2001/06/05 13:22:06	1.14
  @@ -63,7 +63,7 @@
   #include "apr_sms.h"
   
   struct apr_lock_t {
  -    apr_pool_t *cntxt;
  +    apr_pool_t *pool;
       apr_sms_t *mem_sys;
       apr_locktype_e type;
       apr_lockscope_e scope;
  
  
  
  1.13      +1 -1      apr/include/arch/os2/locks.h
  
  Index: locks.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/os2/locks.h,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- locks.h	2001/06/05 08:15:18	1.12
  +++ locks.h	2001/06/05 13:22:12	1.13
  @@ -60,7 +60,7 @@
   #include "apr_sms.h"
   
   struct apr_lock_t {
  -    apr_pool_t *cntxt;
  +    apr_pool_t *pool;
       apr_sms_t *mem_sys;
       apr_locktype_e type;
       apr_lockscope_e scope;
  
  
  
  1.29      +1 -1      apr/include/arch/unix/locks.h
  
  Index: locks.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/locks.h,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- locks.h	2001/06/05 08:15:22	1.28
  +++ locks.h	2001/06/05 13:22:18	1.29
  @@ -109,7 +109,7 @@
   #endif
   
   struct apr_lock_t {
  -    apr_pool_t *cntxt;
  +    apr_pool_t *pool;
       apr_sms_t *mem_sys;
       apr_locktype_e type;
       apr_lockscope_e scope;
  
  
  
  1.10      +1 -1      apr/include/arch/win32/locks.h
  
  Index: locks.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/win32/locks.h,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- locks.h	2001/06/05 08:15:26	1.9
  +++ locks.h	2001/06/05 13:22:23	1.10
  @@ -59,7 +59,7 @@
   #include "apr_sms.h"
   
   struct apr_lock_t {
  -    apr_pool_t *cntxt;
  +    apr_pool_t *pool;
       apr_sms_t *mem_sys;
       apr_locktype_e type;
       apr_lockscope_e scope;
  
  
  
  1.22      +3 -3      apr/locks/beos/crossproc.c
  
  Index: crossproc.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/beos/crossproc.c,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- crossproc.c	2001/06/05 09:15:05	1.21
  +++ crossproc.c	2001/06/05 13:22:27	1.22
  @@ -82,7 +82,7 @@
       }
       new->ben_interproc = 0;
       new->sem_interproc = stat;
  -    APR_REGISTER_CLEANUP(new, (void *)new, lock_inter_cleanup,
  +    APR_CLEANUP_REGISTER(new, (void *)new, lock_inter_cleanup,
                           apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
  @@ -117,13 +117,13 @@
   {
       apr_status_t stat;
       if ((stat = lock_inter_cleanup(lock)) == APR_SUCCESS) {
  -        APR_REMOVE_CLEANUP(lock, lock, lock_inter_cleanup);
  +        APR_CLEANUP_REMOVE(lock, lock, lock_inter_cleanup);
           return APR_SUCCESS;
       }
       return stat;
   }
   
  -apr_status_t child_init_lock(apr_lock_t **lock, apr_pool_t *cont, const char *fname)
  +apr_status_t child_init_lock(apr_lock_t **lock, apr_pool_t *pool, const char *fname)
   {
       return APR_SUCCESS;
   }
  
  
  
  1.18      +2 -2      apr/locks/beos/intraproc.c
  
  Index: intraproc.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/beos/intraproc.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- intraproc.c	2001/06/05 09:15:06	1.17
  +++ intraproc.c	2001/06/05 13:22:28	1.18
  @@ -77,7 +77,7 @@
       }
       new->ben_intraproc = 0;
       new->sem_intraproc = stat;
  -    APR_REGISTER_CLEANUP(new, (void *)new, lock_intra_cleanup,
  +    APR_CLEANUP_REGISTER(new, (void *)new, lock_intra_cleanup,
                           apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
  @@ -112,7 +112,7 @@
   {
       apr_status_t stat;
       if ((stat = lock_intra_cleanup(lock)) == APR_SUCCESS) {
  -        APR_REMOVE_CLEANUP(lock, lock, lock_intra_cleanup);
  +        APR_CLEANUP_REMOVE(lock, lock, lock_intra_cleanup);
           return APR_SUCCESS;
       }
       return stat;
  
  
  
  1.29      +14 -15    apr/locks/beos/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/beos/locks.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- locks.c	2001/06/05 09:15:07	1.28
  +++ locks.c	2001/06/05 13:22:30	1.29
  @@ -58,7 +58,7 @@
   
   apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, 
                              apr_lockscope_e scope, const char *fname, 
  -                           apr_pool_t *cont)
  +                           apr_pool_t *pool)
   {
       apr_lock_t *new;
       apr_status_t stat;
  @@ -67,12 +67,12 @@
       if (type == APR_READWRITE)
           return APR_ENOTIMPL; 
   
  -    new = (apr_lock_t *)apr_palloc(cont, sizeof(apr_lock_t));
  +    new = (apr_lock_t *)apr_pcalloc(pool, sizeof(apr_lock_t));
       if (new == NULL){
           return APR_ENOMEM;
       }
       
  -    new->cntxt = cont;
  +    new->pool  = pool;
       new->type  = type;
       new->scope = scope;
   
  @@ -101,15 +101,14 @@
       if (type == APR_READWRITE)
           return APR_ENOTIMPL; 
   
  -    new = (apr_lock_t *)apr_sms_malloc(mem_sys, sizeof(apr_lock_t));
  +    new = (apr_lock_t *)apr_sms_calloc(mem_sys, sizeof(apr_lock_t));
       if (new == NULL){
           return APR_ENOMEM;
       }
       
       new->mem_sys = mem_sys;
  -    new->cntxt = NULL;
  -    new->type  = type;
  -    new->scope = scope;
  +    new->type    = type;
  +    new->scope   = scope;
   
       if (scope != APR_CROSS_PROCESS) {
           if ((stat = create_intra_lock(new)) != APR_SUCCESS) {
  @@ -221,11 +220,11 @@
   }
   
   apr_status_t apr_lock_child_init(apr_lock_t **lock, const char *fname, 
  -			       apr_pool_t *cont)
  +			       apr_pool_t *pool)
   {
       apr_status_t stat;
       if ((*lock)->scope != APR_CROSS_PROCESS) {
  -        if ((stat = child_init_lock(lock, cont, fname)) != APR_SUCCESS) {
  +        if ((stat = child_init_lock(lock, pool, fname)) != APR_SUCCESS) {
               return stat;
           }
       }
  @@ -234,13 +233,13 @@
   
   apr_status_t apr_lock_data_get(apr_lock_t *lock, const char *key, void *data)
   {
  -    return apr_pool_userdata_get(data, key, lock->cntxt);
  +    return apr_pool_userdata_get(data, key, lock->pool);
   }
   
   apr_status_t apr_lock_data_set(apr_lock_t *lock, void *data, const char *key,
                               apr_status_t (*cleanup) (void *))
   {
  -    return apr_pool_userdata_set(data, key, cleanup, lock->cntxt);
  +    return apr_pool_userdata_set(data, key, cleanup, lock->pool);
   }
   
   apr_status_t apr_os_lock_get(apr_os_lock_t *oslock, apr_lock_t *lock)
  @@ -253,14 +252,14 @@
   }
   
   apr_status_t apr_os_lock_put(apr_lock_t **lock, apr_os_lock_t *thelock, 
  -                           apr_pool_t *cont)
  +                             apr_pool_t *pool)
   {
  -    if (cont == NULL) {
  +    if (pool == NULL) {
           return APR_ENOPOOL;
       }
       if ((*lock) == NULL) {
  -        (*lock) = (apr_lock_t *)apr_pcalloc(cont, sizeof(apr_lock_t));
  -        (*lock)->cntxt = cont;
  +        (*lock) = (apr_lock_t *)apr_pcalloc(pool, sizeof(apr_lock_t));
  +        (*lock)->pool = pool;
       }
       (*lock)->sem_interproc = thelock->sem_interproc;
       (*lock)->ben_interproc = thelock->ben_interproc;
  
  
  
  1.29      +20 -18    apr/locks/os2/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/os2/locks.c,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- locks.c	2001/05/31 03:29:58	1.28
  +++ locks.c	2001/06/05 13:22:37	1.29
  @@ -73,7 +73,7 @@
   
   apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, 
                                apr_lockscope_e scope, const char *fname, 
  -                             apr_pool_t *cont)
  +                             apr_pool_t *pool)
   {
       apr_lock_t *new;
       ULONG rc;
  @@ -84,25 +84,27 @@
       if (type == APR_READWRITE)
           return APR_ENOTIMPL;
   
  -    new = (apr_lock_t *)apr_palloc(cont, sizeof(apr_lock_t));
  -    new->cntxt = cont;
  -    new->type  = type;
  -    new->scope = scope;
  -    new->owner = 0;
  +    new = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t));
  +
  +    new->pool       = pool;
  +    new->type       = type;
  +    new->scope      = scope;
  +    new->owner      = 0;
       new->lock_count = 0;
  -    new->fname = apr_pstrdup(cont, fname);
  +    new->fname      = apr_pstrdup(pool, fname);
  +
       DosGetInfoBlocks(&(new->tib), &ppib);
   
       if (fname == NULL)
           semname = NULL;
       else
  -        semname = apr_pstrcat(cont, "/SEM32/", fname, NULL);
  +        semname = apr_pstrcat(pool, "/SEM32/", fname, NULL);
   
       rc = DosCreateMutexSem(semname, &(new->hMutex), scope == APR_CROSS_PROCESS ?
DC_SEM_SHARED : 0, FALSE);
       *lock = new;
   
       if (!rc)
  -        apr_pool_cleanup_register(cont, new, lock_cleanup, apr_pool_cleanup_null);
  +        apr_pool_cleanup_register(pool, new, lock_cleanup, apr_pool_cleanup_null);
   
       return APR_OS2_STATUS(rc);
   }
  @@ -110,12 +112,12 @@
   
   
   apr_status_t apr_lock_child_init(apr_lock_t **lock, const char *fname,
  -			       apr_pool_t *cont)
  +			       apr_pool_t *pool)
   {
       int rc;
       PIB *ppib;
   
  -    *lock = (apr_lock_t *)apr_palloc(cont, sizeof(apr_lock_t));
  +    *lock = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t));
   
       if (lock == NULL)
           return APR_ENOMEM;
  @@ -126,7 +128,7 @@
       rc = DosOpenMutexSem( (char *)fname, &(*lock)->hMutex );
   
       if (!rc)
  -        apr_pool_cleanup_register(cont, *lock, lock_cleanup, apr_pool_cleanup_null);
  +        apr_pool_cleanup_register(pool, *lock, lock_cleanup, apr_pool_cleanup_null);
   
       return APR_OS2_STATUS(rc);
   }
  @@ -236,14 +238,14 @@
   
   
   apr_status_t apr_os_lock_put(apr_lock_t **lock, apr_os_lock_t *thelock, 
  -                           apr_pool_t *cont)
  +                           apr_pool_t *pool)
   {
  -    if (cont == NULL) {
  +    if (pool == NULL) {
           return APR_ENOPOOL;
       }
       if ((*lock) == NULL) {
  -        (*lock) = (apr_lock_t *)apr_pcalloc(cont, sizeof(apr_lock_t));
  -        (*lock)->cntxt = cont;
  +        (*lock) = (apr_lock_t *)apr_pcalloc(pool, sizeof(apr_lock_t));
  +        (*lock)->pool = pool;
       }
       (*lock)->hMutex = *thelock;
       return APR_SUCCESS;
  @@ -253,7 +255,7 @@
   
   apr_status_t apr_lock_data_get(apr_lock_t *lock, const char *key, void *data)
   {
  -    return apr_pool_userdata_get(data, key, lock->cntxt);
  +    return apr_pool_userdata_get(data, key, lock->pool);
   }
   
   
  @@ -261,5 +263,5 @@
   apr_status_t apr_lock_data_set(apr_lock_t *lock, void *data, const char *key,
                               apr_status_t (*cleanup) (void *))
   {
  -    return apr_pool_userdata_set(data, key, cleanup, lock->cntxt);
  +    return apr_pool_userdata_set(data, key, cleanup, lock->pool);
   }
  
  
  
  1.44      +8 -8      apr/locks/unix/crossproc.c
  
  Index: crossproc.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/crossproc.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- crossproc.c	2001/06/05 08:15:30	1.43
  +++ crossproc.c	2001/06/05 13:22:42	1.44
  @@ -100,7 +100,7 @@
           return errno;
       }
       new->curr_locked = 0;
  -    APR_REGISTER_CLEANUP(new, (void *)new, lock_cleanup, apr_pool_cleanup_null);
  +    APR_CLEANUP_REGISTER(new, (void *)new, lock_cleanup, apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
   
  @@ -137,7 +137,7 @@
       apr_status_t stat;
   
       if ((stat = lock_cleanup(lock)) == APR_SUCCESS) {
  -        APR_REMOVE_CLEANUP(lock, lock, lock_cleanup);
  +        APR_CLEANUP_REMOVE(lock, lock, lock_cleanup);
           return APR_SUCCESS;
       }
       return stat;
  @@ -223,7 +223,7 @@
       }
   
       new->curr_locked = 0;
  -    APR_REGISTER_CLEANUP(new, (void *)new, lock_cleanup, apr_pool_cleanup_null);
  +    APR_CLEANUP_REGISTER(new, (void *)new, lock_cleanup, apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
   
  @@ -259,7 +259,7 @@
   {
       apr_status_t stat;
       if ((stat = lock_cleanup(lock)) == APR_SUCCESS) {
  -        APR_REMOVE_CLEANUP(lock, lock, lock_cleanup);
  +        APR_CLEANUP_REMOVE(lock, lock, lock_cleanup);
           return APR_SUCCESS;
       }
       return stat;
  @@ -316,7 +316,7 @@
   
       new->curr_locked=0;
       unlink(new->fname);
  -    APR_REGISTER_CLEANUP(new, new, lock_cleanup, apr_pool_cleanup_null);
  +    APR_CLEANUP_REGISTER(new, new, lock_cleanup, apr_pool_cleanup_null);
       return APR_SUCCESS; 
   }
   
  @@ -352,7 +352,7 @@
   {
       apr_status_t stat;
       if ((stat = lock_cleanup(lock)) == APR_SUCCESS) {
  -        APR_REMOVE_CLEANUP(lock, lock, lock_cleanup);
  +        APR_CLEANUP_REMOVE(lock, lock, lock_cleanup);
           return APR_SUCCESS;
       }
       return stat;
  @@ -397,7 +397,7 @@
           return errno;
       }
       new->curr_locked = 0;
  -    APR_REGISTER_CLEANUP(new, (void *)new, lock_cleanup, apr_pool_cleanup_null);
  +    APR_CLEANUP_REGISTER(new, (void *)new, lock_cleanup, apr_pool_cleanup_null);
       return APR_SUCCESS;
   }
   
  @@ -433,7 +433,7 @@
   {
       apr_status_t stat;
       if ((stat = lock_cleanup(lock)) == APR_SUCCESS) {
  -        APR_REMOVE_CLEANUP(lock, lock, lock_cleanup);
  +        APR_CLEANUP_REMOVE(lock, lock, lock_cleanup);
           return APR_SUCCESS;
       }
       return stat;
  
  
  
  1.49      +12 -11    apr/locks/unix/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/unix/locks.c,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- locks.c	2001/06/05 08:15:32	1.48
  +++ locks.c	2001/06/05 13:22:45	1.49
  @@ -108,16 +108,17 @@
   
   apr_status_t apr_lock_create(apr_lock_t **lock, apr_locktype_e type, 
                              apr_lockscope_e scope, const char *fname, 
  -                           apr_pool_t *cont)
  +                           apr_pool_t *pool)
   {
       apr_lock_t *new;
       apr_status_t stat;
   
  -    new = (apr_lock_t *)apr_pcalloc(cont, sizeof(apr_lock_t));
  +    new = (apr_lock_t *)apr_pcalloc(pool, sizeof(apr_lock_t));
   
  -    new->cntxt = cont;
  +    new->pool  = pool;
       new->type  = type;
       new->scope = scope;
  +
       if ((stat = create_lock(new, fname)) != APR_SUCCESS)
           return APR_SUCCESS;
   
  @@ -135,9 +136,9 @@
       new = (apr_lock_t *)apr_sms_calloc(mem_sys, sizeof(apr_lock_t));
   
       new->mem_sys = mem_sys;
  -    new->cntxt = NULL;
  -    new->type = type;
  -    new->scope = scope;
  +    new->type    = type;
  +    new->scope   = scope;
  +
       if ((stat = create_lock(new, fname)) != APR_SUCCESS)
           return stat;
   
  @@ -299,13 +300,13 @@
   
   apr_status_t apr_lock_data_get(apr_lock_t *lock, const char *key, void *data)
   {
  -    return apr_pool_userdata_get(data, key, lock->cntxt);
  +    return apr_pool_userdata_get(data, key, lock->pool);
   }
   
   apr_status_t apr_lock_data_set(apr_lock_t *lock, void *data, const char *key,
                               apr_status_t (*cleanup) (void *))
   {
  -    return apr_pool_userdata_set(data, key, cleanup, lock->cntxt);
  +    return apr_pool_userdata_set(data, key, cleanup, lock->pool);
   }
   
   apr_status_t apr_os_lock_get(apr_os_lock_t *oslock, apr_lock_t *lock)
  @@ -321,14 +322,14 @@
   }
   
   apr_status_t apr_os_lock_put(apr_lock_t **lock, apr_os_lock_t *thelock, 
  -                           apr_pool_t *cont)
  +                           apr_pool_t *pool)
   {
       if (cont == NULL) {
           return APR_ENOPOOL;
       }
       if ((*lock) == NULL) {
  -        (*lock) = (apr_lock_t *)apr_pcalloc(cont, sizeof(apr_lock_t));
  -        (*lock)->cntxt = cont;
  +        (*lock) = (apr_lock_t *)apr_pcalloc(pool, sizeof(apr_lock_t));
  +        (*lock)->pool = pool;
       }
       (*lock)->interproc = thelock->crossproc;
   #if APR_HAS_THREADS
  
  
  
  1.40      +15 -15    apr/locks/win32/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/win32/locks.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- locks.c	2001/06/05 08:15:37	1.39
  +++ locks.c	2001/06/05 13:22:50	1.40
  @@ -61,7 +61,7 @@
                                             apr_locktype_e type, 
                                             apr_lockscope_e scope, 
                                             const char *fname,
  -                                          apr_pool_t *cont)
  +                                          apr_pool_t *pool)
   {
       apr_lock_t *newlock;
       SECURITY_ATTRIBUTES sec;
  @@ -70,13 +70,13 @@
       if (type == APR_READWRITE)
           return APR_ENOTIMPL;
   
  -    newlock = (apr_lock_t *)apr_palloc(cont, sizeof(apr_lock_t));
  +    newlock = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t));
   
  -    newlock->cntxt = cont;
  -    /* ToDo:  How to handle the case when no context is available? 
  +    newlock->pool = pool;
  +    /* ToDo:  How to handle the case when no pool is available? 
       *         How to cleanup the storage properly?
       */
  -    newlock->fname = apr_pstrdup(cont, fname);
  +    newlock->fname = apr_pstrdup(pool, fname);
       newlock->type = type;
       newlock->scope = scope;
       sec.nLength = sizeof(SECURITY_ATTRIBUTES);
  @@ -112,7 +112,7 @@
   
       newlock = (apr_lock_t *)apr_sms_malloc(mem_sys, sizeof(apr_lock_t));
   
  -    newlock->cntxt = NULL;
  +    newlock->pool = NULL;
       newlock->mem_sys = mem_sys;
   
       APR_MEM_PSTRDUP(newlock, newlock->fname, fname);
  @@ -139,17 +139,17 @@
   
   APR_DECLARE(apr_status_t) apr_lock_child_init(apr_lock_t **lock, 
                                                 const char *fname, 
  -                                              apr_pool_t *cont)
  +                                              apr_pool_t *pool)
   {
       /* This routine should not be called (and OpenMutex will fail if called) 
        * on a INTRAPROCESS lock
        */
  -    (*lock) = (apr_lock_t *)apr_palloc(cont, sizeof(apr_lock_t));
  +    (*lock) = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t));
   
       if ((*lock) == NULL) {
           return APR_ENOMEM;
       }
  -    (*lock)->fname = apr_pstrdup(cont, fname);
  +    (*lock)->fname = apr_pstrdup(pool, fname);
       (*lock)->mutex = OpenMutex(MUTEX_ALL_ACCESS, TRUE, fname);
       
       if ((*lock)->mutex == NULL) {
  @@ -248,14 +248,14 @@
   APR_DECLARE(apr_status_t) apr_lock_data_get(apr_lock_t *lock, const char *key,
                                              void *data)
   {
  -    return apr_pool_userdata_get(data, key, lock->cntxt);
  +    return apr_pool_userdata_get(data, key, lock->pool);
   }
   
   APR_DECLARE(apr_status_t) apr_lock_data_set(apr_lock_t *lock, void *data,
                                              const char *key,
                                              apr_status_t (*cleanup) (void *))
   {
  -    return apr_pool_userdata_set(data, key, cleanup, lock->cntxt);
  +    return apr_pool_userdata_set(data, key, cleanup, lock->pool);
   }
   
   APR_DECLARE(apr_status_t) apr_os_lock_get(apr_os_lock_t *thelock,
  @@ -267,14 +267,14 @@
   
   APR_DECLARE(apr_status_t) apr_os_lock_put(apr_lock_t **lock,
                                             apr_os_lock_t *thelock,
  -                                          apr_pool_t *cont)
  +                                          apr_pool_t *pool)
   {
  -    if (cont == NULL) {
  +    if (pool == NULL) {
           return APR_ENOPOOL;
       }
       if ((*lock) == NULL) {
  -        (*lock) = (apr_lock_t *)apr_palloc(cont, sizeof(apr_lock_t));
  -        (*lock)->cntxt = cont;
  +        (*lock) = (apr_lock_t *)apr_palloc(pool, sizeof(apr_lock_t));
  +        (*lock)->pool = pool;
       }
       (*lock)->mutex = *thelock;
       return APR_SUCCESS;
  
  
  

Mime
View raw message