From bd549a75ae299604659b06e6c2049b2b81680b31 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 1 Oct 2001 18:27:46 +0000 Subject: if there is a db error, assume deletion (pas_backend_file_changes): write 001-10-01 JP Rosevear * backend/pas/pas-backend-file.c (pas_backend_file_changes_foreach_key): if there is a db error, assume deletion (pas_backend_file_changes): write after all is done for efficiency svn path=/trunk/; revision=13267 --- addressbook/ChangeLog | 7 +++++++ addressbook/backend/pas/pas-backend-file.c | 9 ++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 04730b135e..4ad8a2d67e 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2001-10-01 JP Rosevear + + * backend/pas/pas-backend-file.c + (pas_backend_file_changes_foreach_key): if there is a db error, + assume deletion + (pas_backend_file_changes): write after all is done for efficiency + 2001-09-28 JP Rosevear * backend/pas/pas-backend-file.c diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c index b8ef4931fb..56c6485e7f 100644 --- a/addressbook/backend/pas/pas-backend-file.c +++ b/addressbook/backend/pas/pas-backend-file.c @@ -346,7 +346,7 @@ pas_backend_file_changes_foreach_key (const char *key, gpointer user_data) memset (&vcard_dbt, 0, sizeof (vcard_dbt)); db_error = db->get (db, NULL, &id_dbt, &vcard_dbt, 0); - if (db_error == DB_NOTFOUND) { + if (db_error != 0) { char *id = id_dbt.data; ctx->del_ids = g_list_append (ctx->del_ids, g_strdup (id)); @@ -452,8 +452,6 @@ pas_backend_file_changes (PASBackendFile *bf, char *vcard = v->data; e_dbhash_add (ehash, id, vcard); - e_dbhash_write (ehash); - g_free (i->data); g_free (v->data); } @@ -462,8 +460,6 @@ pas_backend_file_changes (PASBackendFile *bf, char *vcard = v->data; e_dbhash_add (ehash, id, vcard); - e_dbhash_write (ehash); - g_free (i->data); g_free (v->data); } @@ -471,11 +467,10 @@ pas_backend_file_changes (PASBackendFile *bf, char *id = i->data; e_dbhash_remove (ehash, id); - e_dbhash_write (ehash); - g_free (i->data); } + e_dbhash_write (ehash); e_dbhash_destroy (ehash); } -- cgit v1.2.3