apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject cvs commit: apr-util/dbm apr_dbm_berkeleydb.c apr_dbm_gdbm.c
Date Wed, 07 Nov 2001 00:59:00 GMT
gstein      01/11/06 16:59:00

  Modified:    dbm      apr_dbm_berkeleydb.c apr_dbm_gdbm.c
  Log:
  Fix for the NEXTKEY functionality in the Berkeley DB code.
      Submitted by: Mladen Turk
  
  Fix for gdbm code to handle freedatum properly (I broken it when I
  previously removed the NEEDS_CLEANUP cpp symbol).
  
  Revision  Changes    Path
  1.3       +10 -2     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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_dbm_berkeleydb.c	2001/11/06 22:23:26	1.2
  +++ apr_dbm_berkeleydb.c	2001/11/07 00:59:00	1.3
  @@ -169,29 +169,37 @@
   static apr_status_t do_nextkey(real_file_t *f, DBT *pkey, DBT *pnext)
   {
       int dberr;
  -    DBT data;
  +    DBT data = { 0 };
   
  +    memset(pnext, 0, sizeof(*pnext));
  +
   #if DB_VER == 1
       dberr = (*f->bdb->seq)(f->bdb, pkey, &data, R_NEXT);
  +    if (dberr == RET_SPECIAL)
  +        return APR_SUCCESS;
   #else
       if (f->curs == NULL)
           return APR_EINVAL;
   
       dberr = (*f->curs->c_get)(f->curs, pkey, &data, DB_NEXT);
       if (dberr == DB_NOTFOUND) {
  -        memset(pkey, 0, sizeof(*pkey));
           (*f->curs->c_close)(f->curs);
           f->curs = NULL;
           return APR_SUCCESS;
       }
   #endif
   
  +    pnext->data = pkey->data;
  +    pnext->size = pkey->size;
  +
       return db2s(dberr);
   }
   
   /* --------------------------------------------------------------------------
   **
   ** DEFINE THE VTABLE FUNCTIONS FOR BERKELEY DB
  +**
  +** ### we may need three sets of these: db1, db2, db3
   */
   
   static apr_status_t vt_db_open(apr_dbm_t **dbm, const char *name,
  
  
  
  1.3       +3 -0      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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_dbm_gdbm.c	2001/11/06 22:23:26	1.2
  +++ apr_dbm_gdbm.c	2001/11/07 00:59:00	1.3
  @@ -73,6 +73,9 @@
   #define APR_DBM_NEXTKEY(f, k, nk) ((nk) = gdbm_nextkey(f, *(k)), APR_SUCCESS)
   #define APR_DBM_FREEDPTR(dptr)	((dptr) ? free(dptr) : 0)
   
  +/* ### in apr_dbm_freedatum(), run the cleanup */
  +#define NEEDS_CLEANUP
  +
   #undef REGISTER_CLEANUP
   #define REGISTER_CLEANUP(dbm, pdatum) \
       if ((pdatum)->dptr) \
  
  
  

Mime
View raw message