apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr-util/dbm apr_dbm.c apr_dbm_berkeleydb.c apr_dbm_gdbm.c apr_dbm_sdbm.c
Date Thu, 29 Nov 2001 08:15:45 GMT
jerenkrantz    01/11/29 00:15:45

  Modified:    dbm      apr_dbm.c apr_dbm_berkeleydb.c apr_dbm_gdbm.c
                        apr_dbm_sdbm.c
  Log:
  Gratuitous code style changes.  (tabs->spaces, proper format, etc, etc, etc.)
  
  Revision  Changes    Path
  1.36      +9 -14     apr-util/dbm/apr_dbm.c
  
  Index: apr_dbm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/dbm/apr_dbm.c,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- apr_dbm.c	2001/11/28 17:49:46	1.35
  +++ apr_dbm.c	2001/11/29 08:15:45	1.36
  @@ -67,25 +67,21 @@
   #include "apr_dbm_private.h"
   
   /* ### note: the setting of DBM_VTABLE will go away once we have multiple
  -   ### DBMs in here. */
  +   ### DBMs in here. 
  +   ### Well, that day is here.  So, do we remove DBM_VTABLE and the old
  +   ### API entirely?  Oh, what to do.  We need an APU_DEFAULT_DBM #define.
  +   ### Sounds like a job for autoconf. */
   
   #if APU_USE_SDBM
  -
   #define DBM_VTABLE apr_dbm_type_sdbm
  -
   #elif APU_USE_GDBM
  -
   #define DBM_VTABLE apr_dbm_type_gdbm
  -
   #elif APU_USE_DB
  -
   #define DBM_VTABLE apr_dbm_type_db
  -
   #else /* Not in the USE_xDBM list above */
   #error a DBM implementation was not specified
   #endif
   
  -
   APU_DECLARE(apr_status_t) apr_dbm_open_ex(apr_dbm_t **pdb, const char*type, 
                                          const char *pathname, 
                                          apr_int32_t mode, apr_fileperms_t perm,
  @@ -96,7 +92,6 @@
           return (*apr_dbm_type_gdbm.open)(pdb, pathname, mode, perm, pool);
       }
   #endif
  -
   #if APU_HAVE_SDBM
       if (!strcasecmp(type, "SDBM")) {
           return (*apr_dbm_type_sdbm.open)(pdb, pathname, mode, perm, pool);
  @@ -177,11 +172,12 @@
           (void) apr_cpystrn(errbuf, dbm->errmsg, errbufsize);
       return errbuf;
   }
  +
   APU_DECLARE(void) apr_dbm_get_usednames_ex(apr_pool_t *p, 
  -                                        const char*type, 
  -                                        const char *pathname,
  -                                        const char **used1,
  -                                        const char **used2)
  +                                           const char *type, 
  +                                           const char *pathname,
  +                                           const char **used1,
  +                                           const char **used2)
   {
   #if APU_HAVE_GDBM
       if (!strcasecmp(type, "GDBM")) {
  @@ -189,7 +185,6 @@
           return;
       }
   #endif
  -
   #if APU_HAVE_SDBM
       if (!strcasecmp(type, "SDBM")) {
           (*apr_dbm_type_sdbm.getusednames)(p,pathname,used1,used2);
  
  
  
  1.8       +12 -16    apr-util/dbm/apr_dbm_berkeleydb.c
  
  Index: apr_dbm_berkeleydb.c
  ===================================================================
  RCS file: /home/cvs/apr-util/dbm/apr_dbm_berkeleydb.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_dbm_berkeleydb.c	2001/11/28 17:34:17	1.7
  +++ apr_dbm_berkeleydb.c	2001/11/29 08:15:45	1.8
  @@ -63,11 +63,8 @@
   #include "apu.h"
   
   #if APU_HAVE_DB 
  -
   #include "apr_dbm_private.h"
   
  -
  -
   /* this is used in a few places to define a noop "function". it is needed
      to stop "no effect" warnings from GCC. */
   #define NOOP_FUNCTION if (0) ; else
  @@ -97,7 +94,6 @@
   #endif
   } real_file_t;
   
  -
   #undef SET_FILE
   #define SET_FILE(pdb, f) ((pdb)->file = apr_pmemdup((pdb)->pool, \
                                                       &(f), sizeof(f)))
  @@ -120,25 +116,25 @@
   #define GET_BDB(f)      (((real_file_t *)(f))->bdb)
   
   #if DB_VER == 1
  -#define APR_DBM_CLOSE(f)	((*GET_BDB(f)->close)(GET_BDB(f)))
  +#define APR_DBM_CLOSE(f)        ((*GET_BDB(f)->close)(GET_BDB(f)))
   #else
  -#define APR_DBM_CLOSE(f)	((*GET_BDB(f)->close)(GET_BDB(f), 0))
  +#define APR_DBM_CLOSE(f)        ((*GET_BDB(f)->close)(GET_BDB(f), 0))
   #endif
   
  -#define do_fetch(bdb, k, v)       ((*(bdb)->get)(bdb, TXN_ARG &(k), &(v), 0))
  -#define APR_DBM_FETCH(f, k, v)	db2s(do_fetch(GET_BDB(f), k, v))
  -#define APR_DBM_STORE(f, k, v)	db2s((*GET_BDB(f)->put)(GET_BDB(f), TXN_ARG &(k),
&(v), 0))
  -#define APR_DBM_DELETE(f, k)	db2s((*GET_BDB(f)->del)(GET_BDB(f), TXN_ARG &(k), 0))
  +#define do_fetch(bdb, k, v)     ((*(bdb)->get)(bdb, TXN_ARG &(k), &(v), 0))
  +#define APR_DBM_FETCH(f, k, v)  db2s(do_fetch(GET_BDB(f), k, v))
  +#define APR_DBM_STORE(f, k, v)  db2s((*GET_BDB(f)->put)(GET_BDB(f), TXN_ARG &(k),
&(v), 0))
  +#define APR_DBM_DELETE(f, k)    db2s((*GET_BDB(f)->del)(GET_BDB(f), TXN_ARG &(k),
0))
   #define APR_DBM_FIRSTKEY(f, k)  do_firstkey(f, &(k))
   #define APR_DBM_NEXTKEY(f, k, nk) do_nextkey(f, &(k), &(nk))
  -#define APR_DBM_FREEDPTR(dptr)	NOOP_FUNCTION
  +#define APR_DBM_FREEDPTR(dptr)  NOOP_FUNCTION
   
   #if DB_VER == 1
   #include <sys/fcntl.h>
   #define APR_DBM_DBMODE_RO       O_RDONLY
   #define APR_DBM_DBMODE_RW       O_RDWR
   #define APR_DBM_DBMODE_RWCREATE (O_CREAT | O_RDWR)
  -#define APR_DBM_DBMODE_RWTRUNC (O_CREAT | O_RDWR|O_TRUNC)
  +#define APR_DBM_DBMODE_RWTRUNC  (O_CREAT | O_RDWR | O_TRUNC)
   #else
   #define APR_DBM_DBMODE_RO       DB_RDONLY
   #define APR_DBM_DBMODE_RW       0
  @@ -151,7 +147,7 @@
   {
       if (dberr != 0) {
           /* ### need to fix this */
  -        return APR_OS_START_USEERR+dberr;
  +        return APR_OS_START_USEERR + dberr;
       }
   
       return APR_SUCCESS;
  @@ -163,9 +159,9 @@
       int dberr;
       DBT data;
   
  -    memset(pkey,0,sizeof(DBT));
  +    memset(pkey, 0, sizeof(DBT));
   
  -    memset(&data,0,sizeof(DBT));
  +    memset(&data, 0, sizeof(DBT));
   #if DB_VER == 1
       dberr = (*f->bdb->seq)(f->bdb, pkey, &data, R_FIRST);
   #else
  @@ -231,7 +227,7 @@
           /* ### need to fix. dberr was tossed in db2s(). */
           /* ### use db_strerror() */
           dbm->errcode = dbm_said;
  -        dbm->errmsg = db_strerror( dbm_said - APR_OS_START_USEERR);
  +        dbm->errmsg = db_strerror(dbm_said - APR_OS_START_USEERR);
           rv = dbm_said;
       }
   
  
  
  
  1.8       +6 -9      apr-util/dbm/apr_dbm_gdbm.c
  
  Index: apr_dbm_gdbm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/dbm/apr_dbm_gdbm.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- apr_dbm_gdbm.c	2001/11/28 17:34:17	1.7
  +++ apr_dbm_gdbm.c	2001/11/29 08:15:45	1.8
  @@ -61,12 +61,10 @@
   #include "apu.h"
   
   #if APU_HAVE_GDBM 
  -
   #include "apr_dbm_private.h"
   
   #include <gdbm.h>
   
  -
   /* this is used in a few places to define a noop "function". it is needed
      to stop "no effect" warnings from GCC. */
   #define NOOP_FUNCTION if (0) ; else
  @@ -83,14 +81,13 @@
   typedef datum result_datum_t;
   #define RETURN_DATUM(poutput, rd) (*(poutput) = *(apr_datum_t *)&(rd))
   
  -#define APR_DBM_CLOSE(f)	gdbm_close(f)
  -#define APR_DBM_FETCH(f, k, v)	((v) = gdbm_fetch(f, *(k)), APR_SUCCESS)
  -#define APR_DBM_STORE(f, k, v)	g2s(gdbm_store(f, *(k), *(v), GDBM_REPLACE))
  -#define APR_DBM_DELETE(f, k)	g2s(gdbm_delete(f, *(k)))
  -#define APR_DBM_FIRSTKEY(f, k)	((k) = gdbm_firstkey(f), APR_SUCCESS)
  +#define APR_DBM_CLOSE(f)        gdbm_close(f)
  +#define APR_DBM_FETCH(f, k, v)  ((v) = gdbm_fetch(f, *(k)), APR_SUCCESS)
  +#define APR_DBM_STORE(f, k, v)  g2s(gdbm_store(f, *(k), *(v), GDBM_REPLACE))
  +#define APR_DBM_DELETE(f, k)    g2s(gdbm_delete(f, *(k)))
  +#define APR_DBM_FIRSTKEY(f, k)  ((k) = gdbm_firstkey(f), APR_SUCCESS)
   #define APR_DBM_NEXTKEY(f, k, nk) ((nk) = gdbm_nextkey(f, *(k)), APR_SUCCESS)
  -#define APR_DBM_FREEDPTR(dptr)	((dptr) ? free(dptr) : 0)
  -
  +#define APR_DBM_FREEDPTR(dptr)  ((dptr) ? free(dptr) : 0)
   
   #undef REGISTER_CLEANUP
   #define REGISTER_CLEANUP(dbm, pdatum) \
  
  
  
  1.7       +10 -10    apr-util/dbm/apr_dbm_sdbm.c
  
  Index: apr_dbm_sdbm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/dbm/apr_dbm_sdbm.c,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apr_dbm_sdbm.c	2001/11/28 17:34:17	1.6
  +++ apr_dbm_sdbm.c	2001/11/29 08:15:45	1.7
  @@ -68,7 +68,6 @@
   #include <stdlib.h>  /* For abort() */
   #endif
   
  -
   /* this is used in a few places to define a noop "function". it is needed
      to stop "no effect" warnings from GCC. */
   #define NOOP_FUNCTION if (0) ; else
  @@ -85,18 +84,19 @@
   typedef apr_sdbm_datum_t result_datum_t;
   #define RETURN_DATUM(poutput, rd) (*(poutput) = *(apr_datum_t *)&(rd))
   
  -#define APR_DBM_CLOSE(f)	apr_sdbm_close(f)
  -#define APR_DBM_FETCH(f, k, v)	apr_sdbm_fetch(f, &(v), *(k))
  -#define APR_DBM_STORE(f, k, v)	apr_sdbm_store(f, *(k), *(v), APR_SDBM_REPLACE)
  -#define APR_DBM_DELETE(f, k)	apr_sdbm_delete(f, *(k))
  -#define APR_DBM_FIRSTKEY(f, k)	apr_sdbm_firstkey(f, &(k))
  +#define APR_DBM_CLOSE(f)        apr_sdbm_close(f)
  +#define APR_DBM_FETCH(f, k, v)  apr_sdbm_fetch(f, &(v), *(k))
  +#define APR_DBM_STORE(f, k, v)  apr_sdbm_store(f, *(k), *(v), APR_SDBM_REPLACE)
  +#define APR_DBM_DELETE(f, k)    apr_sdbm_delete(f, *(k))
  +#define APR_DBM_FIRSTKEY(f, k)  apr_sdbm_firstkey(f, &(k))
   #define APR_DBM_NEXTKEY(f, k, nk) apr_sdbm_nextkey(f, &(nk))
  -#define APR_DBM_FREEDPTR(dptr)	NOOP_FUNCTION
  +#define APR_DBM_FREEDPTR(dptr)  NOOP_FUNCTION
   
   #define APR_DBM_DBMODE_RO       APR_READ
   #define APR_DBM_DBMODE_RW       (APR_READ | APR_WRITE)
   #define APR_DBM_DBMODE_RWCREATE (APR_READ | APR_WRITE | APR_CREATE)
  -#define APR_DBM_DBMODE_RWTRUNC  (APR_READ | APR_WRITE | APR_CREATE|APR_TRUNCATE)
  +#define APR_DBM_DBMODE_RWTRUNC  (APR_READ | APR_WRITE | APR_CREATE | \
  +                                 APR_TRUNCATE)
   
   static apr_status_t set_error(apr_dbm_t *dbm, apr_status_t dbm_said)
   {
  @@ -221,9 +221,9 @@
       apr_sdbm_datum_t *ckey = (apr_sdbm_datum_t *)&key;
   
       {
  -	apr_sdbm_datum_t value;
  +        apr_sdbm_datum_t value;
           if (apr_sdbm_fetch(dbm->file, &value, *ckey) != APR_SUCCESS) {
  -	    exists = 0;
  +            exists = 0;
           }
           else
               exists = value.dptr != NULL;
  
  
  

Mime
View raw message