Changed the API for cdb_rewind() / cdb_next_item() to make the caller hold the cursor
[citadel.git] / citadel / server / modules / expire / serv_expire.c
index 096360aa4229deaed24add2d4c59c981556e849e..e07c5138285fa894fa62e2312a1ac355c7d01265 100644 (file)
@@ -507,8 +507,8 @@ int PurgeVisits(void) {
        ForEachUser(AddValidUser, NULL);
 
        // Now traverse through the visits, purging irrelevant records...
-       cdb_rewind(CDB_VISIT);
-       while(cdbvisit = cdb_next_item(CDB_VISIT), cdbvisit != NULL) {
+       void *cur = cdb_rewind(CDB_VISIT);
+       while(cdbvisit = cdb_next_item(cur, CDB_VISIT), cdbvisit != NULL) {
                memset(&vbuf, 0, sizeof(struct visit));
                memcpy(&vbuf, cdbvisit->ptr,
                        ( (cdbvisit->len > sizeof(struct visit)) ?
@@ -587,8 +587,8 @@ int PurgeUseTable(StrBuf *ErrMsg) {
        // Phase 1: traverse through the table, discovering old records...
 
        syslog(LOG_DEBUG, "Purge use table: phase 1");
-       cdb_rewind(CDB_USETABLE);
-       while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) {
+       void *cur = cdb_rewind(CDB_USETABLE);
+       while(cdbut = cdb_next_item(cur, CDB_USETABLE), cdbut != NULL) {
                ++total;
                if (cdbut->len > sizeof(struct UseTable))
                        memcpy(&ut, cdbut->ptr, sizeof(struct UseTable));
@@ -629,8 +629,8 @@ int PurgeEuidIndexTable(void) {
 
        // Phase 1: traverse through the table, discovering old records...
        syslog(LOG_DEBUG, "Purge EUID index: phase 1");
-       cdb_rewind(CDB_EUIDINDEX);
-       while(cdbei = cdb_next_item(CDB_EUIDINDEX), cdbei != NULL) {
+       void *cur = cdb_rewind(CDB_EUIDINDEX);
+       while(cdbei = cdb_next_item(cur, CDB_EUIDINDEX), cdbei != NULL) {
 
                memcpy(&msgnum, cdbei->ptr, sizeof(long));