aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-09-29 05:17:30 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-09-29 05:17:30 +0800
commit50f54e757ca63df54eba9ca7125d1f4244239f2c (patch)
tree5278a9fbc8cc75efeabdd59077ae688854adda4b /addressbook/backend
parentf26378de36f4702f0e1d83b50b2046ad053798a2 (diff)
downloadgsoc2013-evolution-50f54e757ca63df54eba9ca7125d1f4244239f2c.tar.gz
gsoc2013-evolution-50f54e757ca63df54eba9ca7125d1f4244239f2c.tar.zst
gsoc2013-evolution-50f54e757ca63df54eba9ca7125d1f4244239f2c.zip
g_strdup (pas_backend_file_changes): ditto, make sure to free all data and
2001-09-28 JP Rosevear <jpr@ximian.com> * backend/pas/pas-backend-file.c (pas_backend_file_changes_foreach_key): g_strdup (pas_backend_file_changes): ditto, make sure to free all data and do a hash write after each add/remove * conduit/address-conduit.c (local_record_to_pilot_record): use the local record category (local_record_from_ecard): ndle the fields and category we don't sync by making sure we don't overwrite them svn path=/trunk/; revision=13232
Diffstat (limited to 'addressbook/backend')
-rw-r--r--addressbook/backend/pas/pas-backend-file.c63
1 files changed, 39 insertions, 24 deletions
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 990d53e704..b8ef4931fb 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -349,7 +349,7 @@ pas_backend_file_changes_foreach_key (const char *key, gpointer user_data)
if (db_error == DB_NOTFOUND) {
char *id = id_dbt.data;
- ctx->del_ids = g_list_append (ctx->del_ids, strdup (id));
+ ctx->del_ids = g_list_append (ctx->del_ids, g_strdup (id));
}
}
@@ -409,12 +409,14 @@ pas_backend_file_changes (PASBackendFile *bf,
case E_DBHASH_STATUS_SAME:
break;
case E_DBHASH_STATUS_NOT_FOUND:
- ctx->add_cards = g_list_append (ctx->add_cards, strdup(vcard_string));
- ctx->add_ids = g_list_append (ctx->add_ids, strdup(id));
+ ctx->add_cards = g_list_append (ctx->add_cards,
+ g_strdup(vcard_string));
+ ctx->add_ids = g_list_append (ctx->add_ids, g_strdup(id));
break;
case E_DBHASH_STATUS_DIFFERENT:
- ctx->mod_cards = g_list_append (ctx->mod_cards, strdup(vcard_string));
- ctx->mod_ids = g_list_append (ctx->mod_ids, strdup(id));
+ ctx->mod_cards = g_list_append (ctx->mod_cards,
+ g_strdup(vcard_string));
+ ctx->mod_ids = g_list_append (ctx->mod_ids, g_strdup(id));
break;
}
}
@@ -426,25 +428,6 @@ pas_backend_file_changes (PASBackendFile *bf,
e_dbhash_foreach_key (ehash, (EDbHashFunc)pas_backend_file_changes_foreach_key, view->change_context);
- /* Update the hash */
- for (i = ctx->add_ids, v = ctx->add_cards; i != NULL; i = i->next, v = v->next){
- char *id = i->data;
- char *vcard = v->data;
- e_dbhash_add (ehash, id, vcard);
- }
- for (i = ctx->mod_ids, v = ctx->mod_cards; i != NULL; i = i->next, v = v->next){
- char *id = i->data;
- char *vcard = v->data;
- e_dbhash_add (ehash, id, vcard);
- }
- for (i = ctx->del_ids; i != NULL; i = i->next){
- char *id = i->data;
- e_dbhash_remove (ehash, id);
- }
-
- e_dbhash_write (ehash);
- e_dbhash_destroy (ehash);
-
/* Send the changes */
if (db_error != DB_NOTFOUND) {
g_warning ("pas_backend_file_changes: error building list\n");
@@ -462,6 +445,38 @@ pas_backend_file_changes (PASBackendFile *bf,
pas_book_view_notify_complete (view->book_view);
}
+
+ /* Update the hash */
+ for (i = ctx->add_ids, v = ctx->add_cards; i != NULL; i = i->next, v = v->next){
+ char *id = i->data;
+ char *vcard = v->data;
+
+ e_dbhash_add (ehash, id, vcard);
+ e_dbhash_write (ehash);
+
+ g_free (i->data);
+ g_free (v->data);
+ }
+ for (i = ctx->mod_ids, v = ctx->mod_cards; i != NULL; i = i->next, v = v->next){
+ char *id = i->data;
+ char *vcard = v->data;
+
+ e_dbhash_add (ehash, id, vcard);
+ e_dbhash_write (ehash);
+
+ g_free (i->data);
+ g_free (v->data);
+ }
+ for (i = ctx->del_ids; i != NULL; i = i->next){
+ char *id = i->data;
+
+ e_dbhash_remove (ehash, id);
+ e_dbhash_write (ehash);
+
+ g_free (i->data);
+ }
+
+ e_dbhash_destroy (ehash);
}
static char *