--- parser3/src/lib/sdbm/sdbm.c 2003/11/05 08:31:09 1.1 +++ parser3/src/lib/sdbm/sdbm.c 2008/01/25 18:59:38 1.4 @@ -71,7 +71,7 @@ #include "sdbm_private.h" #include /* for memset() */ -#include /* for malloc() and free() */ +// #include /* for malloc() and free() */ /* * forward @@ -120,7 +120,7 @@ static apr_status_t database_cleanup(voi (void) apr_file_unlock(db->dirf); (void) apr_file_close(db->dirf); (void) apr_file_close(db->pagf); - free(db); +// free(db); // libcg will do it return APR_SUCCESS; } @@ -133,8 +133,9 @@ static apr_status_t prep(apr_sdbm_t **pd *pdb = NULL; - db = malloc(sizeof(*db)); - memset(db, 0, sizeof(*db)); +// db = malloc(sizeof(*db)); +// memset(db, 0, sizeof(*db)); + db = apr_malloc(sizeof(*db)); db->pool = p; @@ -191,7 +192,7 @@ static apr_status_t prep(apr_sdbm_t **pd goto error; /* make sure that we close the database at some point */ - apr_pool_cleanup_register(p, db, database_cleanup, apr_pool_cleanup_null); + //apr_pool_cleanup_register(p, db, database_cleanup, apr_pool_cleanup_null); /* Done! */ *pdb = db; @@ -205,7 +206,7 @@ error: if (db->pagf != NULL) { (void) apr_file_close(db->pagf); } - free(db); +// free(db); // libcg will do it return status; } @@ -221,7 +222,8 @@ APU_DECLARE(apr_status_t) apr_sdbm_open( APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db) { - return apr_pool_cleanup_run(db->pool, db, database_cleanup); + database_cleanup(db); return APR_SUCCESS; + //return apr_pool_cleanup_run(db->pool, db, database_cleanup); } APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db, apr_sdbm_datum_t *val, @@ -272,7 +274,7 @@ APU_DECLARE(apr_status_t) apr_sdbm_delet if ((status = getpage(db, exhash(key))) == APR_SUCCESS) { if (!delpair(db->pagbuf, key)) /* ### should we define some APRUTIL codes? */ - status = APR_EGENERAL; + status = APR_SUCCESS; /* PAF: were APR_EGENERAL, contradicting comment in .h file :( */ else status = write_page(db, db->pagbuf, db->pagbno); }