You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by gs...@apache.org on 2001/01/24 09:26:20 UTC

cvs commit: apr/file_io/win32 open.c

gstein      01/01/24 00:26:20

  Modified:    include  apr_pools.h apr_file_io.h apr_general.h
               buckets  apr_buckets_file.c
               modules/mappers mod_so.c
               .        STATUS
               file_io/os2 open.c
               file_io/unix open.c
               file_io/win32 open.c
  Log:
  Use a typesafe function for access objects' pools.
  
  Revision  Changes    Path
  1.40      +32 -2     apr/include/apr_pools.h
  
  Index: apr_pools.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_pools.h,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -u -r1.39 -r1.40
  --- apr_pools.h	2001/01/18 20:07:21	1.39
  +++ apr_pools.h	2001/01/24 08:26:18	1.40
  @@ -386,9 +386,39 @@
    */
   APR_DECLARE_NONSTD(apr_status_t) apr_null_cleanup(void *data);
   
  -/* used to guarantee to the apr_pool_t debugging code that the sub apr_pool_t
  - * will not be destroyed before the parent pool
  +/*
  + * Pool accessor functions.
  + *
  + * These standardized function are used by opaque (APR) data types to return
  + * the apr_pool_t that is associated with the data type.
  + *
  + * APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the
  + * accessor function. A typical usage and result would be:
  + *
  + *    APR_POOL_DECLARE_ACCESSOR(file);
  + * becomes:
  + *    APR_DECLARE(apr_pool_t *) apr_get_file_pool(apr_file_t *ob);
  + *
  + * In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to
  + * actually define the function. It assumes the field is named "pool". For
  + * data types with a different field name (e.g. "cont" or "cntxt") the
  + * APR_POOL_IMPLEMENT_ACCESSOR_X() macro should be used.
  + *
  + * Note: the linkage is specified for APR. It would be possible to expand
  + *       the macros to support other linkages.
    */
  +#define APR_POOL_DECLARE_ACCESSOR(typename) \
  +	APR_DECLARE(apr_pool_t *) apr_get_##typename##_pool \
  +		(apr_##typename##_t *ob);
  +
  +#define APR_POOL_IMPLEMENT_ACCESSOR(typename) \
  +	APR_POOL_IMPLEMENT_ACCESSOR_X(typename, pool)
  +#define APR_POOL_IMPLEMENT_ACCESSOR_X(typename, fieldname) \
  +	APR_DECLARE(apr_pool_t *) apr_get_##typename##_pool \
  +		(apr_##typename##_t *ob) { return ob->fieldname; }
  +
  +/* used to guarantee to the apr_pool_t debugging code that the sub apr_pool_t
  + * will not be destroyed before the parent pool */
   #ifndef APR_POOL_DEBUG
   #ifdef apr_pool_join
   #undef apr_pool_join
  
  
  
  1.92      +7 -2      apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_file_io.h,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -u -r1.91 -r1.92
  --- apr_file_io.h	2001/01/21 16:27:07	1.91
  +++ apr_file_io.h	2001/01/24 08:26:19	1.92
  @@ -527,10 +527,15 @@
                                             apr_int32_t wanted,
                                             apr_file_t *thefile);
   
  +/**
  + * Get the pool used by the file.
  + * @return apr_pool_t the pool
  + * @deffunc apr_pool_t apr_get_file_pool(apr_file_t *f)
  + */
  +APR_POOL_DECLARE_ACCESSOR(file);
  +
   #ifdef __cplusplus
   }
   #endif
   
   #endif  /* ! APR_FILE_IO_H */
  -
  -
  
  
  
  1.49      +0 -10     apr/include/apr_general.h
  
  Index: apr_general.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_general.h,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -u -r1.48 -r1.49
  --- apr_general.h	2001/01/18 20:07:19	1.48
  +++ apr_general.h	2001/01/24 08:26:19	1.49
  @@ -210,16 +210,6 @@
   #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
   #endif
   
  -/* This is a general apr type that should only ever be used in the APR_GET_POOL
  - * macro.  This is basically used to let us get the pool from any apr type
  - * that has one.
  - */
  -struct apr_t {
  -    apr_pool_t *pool;
  -};
  -
  -#define APR_GET_POOL(foo) \
  -	((struct apr_t *)foo)->pool
   
   /* A couple of prototypes for functions in case some platform doesn't 
    * have it
  
  
  
  1.25      +1 -1      apr-util/buckets/apr_buckets_file.c
  
  Index: apr_buckets_file.c
  ===================================================================
  RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -u -r1.24 -r1.25
  --- apr_buckets_file.c	2001/01/23 22:24:03	1.24
  +++ apr_buckets_file.c	2001/01/24 08:26:19	1.25
  @@ -106,7 +106,7 @@
           /* we need to protect ourselves in case we die while we've got the
            * file mmapped */
           apr_status_t status;
  -        apr_pool_t *p = APR_GET_POOL(f);
  +        apr_pool_t *p = apr_get_file_pool(f);
           if ((status = apr_mmap_create(&mm, f, s->start, e->length, 
                                         APR_MMAP_READ, p)) != APR_SUCCESS) {
               mm = NULL;
  
  
  
  1.36      +0 -1      httpd-2.0/modules/mappers/mod_so.c
  
  Index: mod_so.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_so.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -u -r1.35 -r1.36
  --- mod_so.c	2001/01/19 22:29:11	1.35
  +++ mod_so.c	2001/01/24 08:26:19	1.36
  @@ -126,7 +126,6 @@
    */
   
   #include "apr.h"
  -#include "apr_general.h" /* for APR_GET_POOL() */
   #include "apr_dso.h"
   #include "apr_strings.h"
   #include "apr_errno.h"
  
  
  
  1.29      +4 -4      apr/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/apr/STATUS,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -u -r1.28 -r1.29
  --- STATUS	2001/01/24 02:24:43	1.28
  +++ STATUS	2001/01/24 08:26:19	1.29
  @@ -1,5 +1,5 @@
   APACHE PORTABLE RUNTIME (APR) LIBRARY STATUS:			-*-text-*-
  -Last modified at [$Date: 2001/01/24 02:24:43 $]
  +Last modified at [$Date: 2001/01/24 08:26:19 $]
   
   Release:
   
  @@ -18,9 +18,6 @@
       * Many linkage errors are gpfaulting Apache/win32 in various configs
         (load mod_dav, for example.)
   
  -    * Replace APR_GET_POOL macro with a typesafe mechanism to get the pool
  -      from an APR (incomplete) type.
  -
   RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
   
       * Unix, OS2 apr_stat/lstat/getfileinfo were very fast hacks.  These
  @@ -92,6 +89,9 @@
       * Change the return type of apr_hash_count() to some counter type 
         (like "int") instead of a size type (apr_size_t).  Jeff will
         do this Real Soon Now (so he says on 20010121).
  +
  +    * add the rest of the pool accessor declare/impl macros.
  +      Status: Greg volunteers
   
   Documentation that needs writing:
   
  
  
  
  1.35      +2 -0      apr/file_io/os2/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/os2/open.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -u -r1.34 -r1.35
  --- open.c	2000/11/14 06:40:03	1.34
  +++ open.c	2001/01/24 08:26:20	1.35
  @@ -262,3 +262,5 @@
   
       return APR_SUCCESS;
   }
  +
  +APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
  
  
  
  1.68      +2 -0      apr/file_io/unix/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/open.c,v
  retrieving revision 1.67
  retrieving revision 1.68
  diff -u -u -r1.67 -r1.68
  --- open.c	2000/11/14 06:40:03	1.67
  +++ open.c	2001/01/24 08:26:20	1.68
  @@ -267,3 +267,5 @@
   
       return APR_SUCCESS;
   }
  +
  +APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);
  
  
  
  1.64      +1 -0      apr/file_io/win32/open.c
  
  Index: open.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/win32/open.c,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -u -r1.63 -r1.64
  --- open.c	2001/01/23 19:53:40	1.63
  +++ open.c	2001/01/24 08:26:20	1.64
  @@ -416,3 +416,4 @@
       return APR_SUCCESS;
   }
   
  +APR_POOL_IMPLEMENT_ACCESSOR_X(file, cntxt);