« Return to Thread: [patch 00/13] [RFC] Hashtable improvements and API changes

[patch 06/13] Make use of OSyncList in Archive

by Daniel Gollub :: Rate this Message:

Reply to Author | View in Thread

Make use of OSyncList instead of GList, since osync_db_query makes also use of
OSyncList. osync_db_exists got renamed t osync_db_table_exists.

---
 opensync/archive/opensync_archive.c |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

Index: opensync/opensync/archive/opensync_archive.c
===================================================================
--- opensync.orig/opensync/archive/opensync_archive.c
+++ opensync/opensync/archive/opensync_archive.c
@@ -57,7 +57,7 @@ static osync_bool osync_archive_create_c
  osync_assert(objtype);
 
  char *tbl_changes = g_strdup_printf("tbl_changes_%s", objtype);
- int ret = osync_db_exists(db, tbl_changes, error);
+ int ret = osync_db_table_exists(db, tbl_changes, error);
  g_free(tbl_changes);
 
  /* error if ret -1 */
@@ -94,7 +94,7 @@ static osync_bool osync_archive_create_c
  osync_assert(objtype);
 
  char *tbl_changelog = g_strdup_printf("tbl_changelog_%s", objtype);
- int ret = osync_db_exists(db, tbl_changelog, error);
+ int ret = osync_db_table_exists(db, tbl_changelog, error);
  g_free(tbl_changelog);
 
  /* error if ret -1 */
@@ -130,7 +130,7 @@ static osync_bool osync_archive_create(O
  osync_assert(objtype);
 
  char *tbl_archive = g_strdup_printf("tbl_archive_%s", objtype);
- int ret = osync_db_exists(db, tbl_archive, error);
+ int ret = osync_db_table_exists(db, tbl_archive, error);
  g_free(tbl_archive);
 
  /* error if ret -1 */
@@ -425,7 +425,7 @@ osync_bool osync_archive_load_changes(OS
  osync_assert(mappingids);
  osync_assert(memberids);
 
- GList *result = NULL, *row = NULL;
+ OSyncList *result = NULL, *row = NULL;
 
  if (!osync_archive_create_changes(archive->db, objtype, error))
  goto error;
@@ -440,12 +440,12 @@ osync_bool osync_archive_load_changes(OS
  goto error;
 
  for (row = result; row; row = row->next) {
- GList *column = row->data;
+ OSyncList *column = row->data;
 
- long long int id = g_ascii_strtoull(g_list_nth_data(column, 0), NULL, 0);
- const char *uid = g_list_nth_data(column, 1);
- long long int mappingid = g_ascii_strtoull(g_list_nth_data(column, 2), NULL, 0);
- long long int memberid = g_ascii_strtoull(g_list_nth_data(column, 3), NULL, 0);
+ long long int id = g_ascii_strtoull(osync_list_nth_data(column, 0), NULL, 0);
+ const char *uid = osync_list_nth_data(column, 1);
+ long long int mappingid = g_ascii_strtoull(osync_list_nth_data(column, 2), NULL, 0);
+ long long int memberid = g_ascii_strtoull(osync_list_nth_data(column, 3), NULL, 0);
 
  *ids = osync_list_append((*ids), GINT_TO_POINTER((int)id));
  *uids = osync_list_append((*uids), g_strdup(uid));
@@ -518,8 +518,8 @@ osync_bool osync_archive_load_ignored_co
  osync_assert(ids);
  osync_assert(changetypes);
 
- GList *result = NULL;
- GList *row = NULL;
+ OSyncList *result = NULL;
+ OSyncList *row = NULL;
 
  if (!osync_archive_create_changelog(archive->db, objtype, error))
  goto error;
@@ -534,10 +534,10 @@ osync_bool osync_archive_load_ignored_co
  goto error;
 
  for (row = result; row; row = row->next) {
- GList *column = row->data;
+ OSyncList *column = row->data;
 
- long long int id = g_ascii_strtoull(g_list_nth_data(column, 0), NULL, 0);
- int changetype = atoi(g_list_nth_data(column, 1));
+ long long int id = g_ascii_strtoull(osync_list_nth_data(column, 0), NULL, 0);
+ int changetype = atoi(osync_list_nth_data(column, 1));
 
  *ids = osync_list_append((*ids), GINT_TO_POINTER((int)id));
  *changetypes = osync_list_append((*changetypes), GINT_TO_POINTER((int)changetype));


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Opensync-devel mailing list
Opensync-devel@...
https://lists.sourceforge.net/lists/listinfo/opensync-devel

 « Return to Thread: [patch 00/13] [RFC] Hashtable improvements and API changes