saving my work before I do the rest of the functions en masse
authorArt Cancro <ajc@citadel.org>
Tue, 8 Aug 2023 21:47:13 +0000 (17:47 -0400)
committerArt Cancro <ajc@citadel.org>
Tue, 8 Aug 2023 21:47:13 +0000 (17:47 -0400)
citadel/server/database.h
citadel/server/database_bdb.c

index 48da24eac48257247c97f967308ba2ddec4ecaed..f1da45f7627891113c2886f1dcfc2a57f69b66fa 100644 (file)
@@ -14,7 +14,6 @@ void                  cdb_open_databases(void);
 void                   cdb_close_databases(void);
 int                    cdb_store(int, const void *, int, void *, int);
 int                    cdb_delete(int, void *, int);
-struct cdbdata *       cdb_fetch(int, const void *, int);
 void                   cdb_free(struct cdbdata *);
 struct cdbdata *       cdb_next_item(int);
 void                   cdb_close_cursor(int);
@@ -25,6 +24,7 @@ void                  cdb_trunc(int);
 void                   cdb_chmod_data(void);
 void                   check_handles(void *);
 
+extern struct cdbdata *        (*cdb_fetch)(int, const void *, int);
 extern void            (*cdb_checkpoint)(void);
 extern void            (*cdb_compact)(void);
 extern void            (*cdb_rewind)(int);
index d84a497d4db5cd787a4a55b0a587dcf7ca773277..6f55c476f0d94a82c3619e775a3f21930ce123ca 100644 (file)
 #include "citserver.h"
 #include "config.h"
 
-void (*cdb_compact)(void)      = NULL;
-void (*cdb_checkpoint)(void)   = NULL;
-void (*cdb_rewind)(int)                = NULL;
+void                   (*cdb_compact)(void)                            = NULL;
+void                   (*cdb_checkpoint)(void)                         = NULL;
+void                   (*cdb_rewind)(int)                              = NULL;
+struct cdbdata *       (*cdb_fetch)(int, const void *, int)            = NULL;
 
 static DB *dbp[MAXCDB];                // One DB handle for each Citadel database
 static DB_ENV *dbenv;          // The DB environment (global)
@@ -529,7 +530,7 @@ static DBC *localcursor(int cdb) {
 // Fetch a piece of data.  If not found, returns NULL.  Otherwise, it returns
 // a struct cdbdata which it is the caller's responsibility to free later on
 // using the cdb_free() routine.
-struct cdbdata *cdb_fetch(int cdb, const void *key, int keylen) {
+struct cdbdata *bdb_fetch(int cdb, const void *key, int keylen) {
 
        if (keylen == 0) {              // key length zero is impossible
                return(NULL);
@@ -749,5 +750,6 @@ void cdb_init_backends(void) {
        cdb_compact = bdb_compact;
        cdb_checkpoint = bdb_checkpoint;
        cdb_rewind = bdb_rewind;
+       cdb_fetch = bdb_fetch;
        syslog(LOG_INFO, "db: initialized Berkeley DB backend");
 }