]> code.citadel.org Git - citadel.git/blobdiff - citadel/server/backends/berkeley_db/berkeley_db.c
Revert "Changed the API for cdb_rewind() / cdb_next_item() to make the caller hold...
[citadel.git] / citadel / server / backends / berkeley_db / berkeley_db.c
index 21c703a5f1f785e6c0f9433a4b7af7db060f5efb..ee437e0467ba1278e5764ef4a0dabe96ea05240f 100644 (file)
@@ -603,13 +603,16 @@ void bdb_close_cursor(int cdb) {
 }
 
 
-// Prepare for a sequential search of an entire database.  Returns a cursor.
-void *bdb_rewind(int cdb) {
+// Prepare for a sequential search of an entire database.
+// (There is guaranteed to be no more than one traversal in
+// progress per thread at any given time.)
+void bdb_rewind(int cdb) {
        int ret = 0;
 
        if (TSD->cursors[cdb] != NULL) {
                syslog(LOG_ERR, "bdb: bdb_rewind: must close cursor on database %d before reopening", cdb);
                bdb_abort();
+               // bdb_cclose(TSD->cursors[cdb]);
        }
 
        // Now initialize the cursor
@@ -618,15 +621,12 @@ void *bdb_rewind(int cdb) {
                syslog(LOG_ERR, "bdb: bdb_rewind: db_cursor: %s", db_strerror(ret));
                bdb_abort();
        }
-
-       syslog(LOG_DEBUG, "\033[33m--- begin cursor %x ---\033[0m", cdb);
-       return((void *)TSD->cursors[cdb]);
 }
 
 
 // Fetch the next item in a sequential search.  Returns a pointer to a 
 // cdbdata structure, or NULL if we've hit the end.
-struct cdbdata *bdb_next_item(void *cursor, int cdb) {
+struct cdbdata *bdb_next_item(int cdb) {
        DBT key, data;
        struct cdbdata *cdbret;
        int ret = 0;
@@ -644,7 +644,6 @@ struct cdbdata *bdb_next_item(void *cursor, int cdb) {
                        bdb_abort();
                }
                bdb_close_cursor(cdb);
-               syslog(LOG_DEBUG, "\033[33m--- end cursor %x ---\033[0m", cdb);
                return NULL;    // presumably, end of file
        }