obexd: Merge phonebook_data and cache_data
phonebook_data and cache_data are merged in phonebook-tracker.c.
Single structure is used in successive patches to keep reference
to pending D-Bus call.
diff --git a/obexd/plugins/phonebook-tracker.c b/obexd/plugins/phonebook-tracker.c
index b7acead..cc4b49f 100644
--- a/obexd/plugins/phonebook-tracker.c
+++ b/obexd/plugins/phonebook-tracker.c
@@ -941,14 +941,8 @@
gboolean vcardentry;
const struct apparam_field *params;
GSList *contacts;
-};
-
-struct cache_data {
phonebook_cache_ready_cb ready_cb;
phonebook_entry_cb entry_cb;
- void *user_data;
- GString *listing;
- int index;
};
struct phonebook_index {
@@ -1706,7 +1700,7 @@
static void add_to_cache(char **reply, int num_fields, void *user_data)
{
- struct cache_data *cache = user_data;
+ struct phonebook_data *data = user_data;
char *formatted;
int i;
@@ -1732,11 +1726,11 @@
/* The owner vCard must have the 0 handle */
if (strcmp(reply[0], TRACKER_DEFAULT_CONTACT_ME) == 0)
- cache->entry_cb(reply[0], 0, formatted, "",
- reply[6], cache->user_data);
+ data->entry_cb(reply[0], 0, formatted, "",
+ reply[6], data->user_data);
else
- cache->entry_cb(reply[0], PHONEBOOK_INVALID_HANDLE, formatted,
- "", reply[6], cache->user_data);
+ data->entry_cb(reply[0], PHONEBOOK_INVALID_HANDLE, formatted,
+ "", reply[6], data->user_data);
g_free(formatted);
@@ -1744,10 +1738,10 @@
done:
if (num_fields <= 0)
- cache->ready_cb(cache->user_data);
+ data->ready_cb(data->user_data);
/*
- * cache is freed in query_free_data after call is unreffed.
+ * data is freed in query_free_data after call is unreffed.
* It is accessible by pointer from data (pending) associated to call.
* Useful in cases when call was terminated.
*/
@@ -1919,7 +1913,7 @@
void *phonebook_create_cache(const char *name, phonebook_entry_cb entry_cb,
phonebook_cache_ready_cb ready_cb, void *user_data, int *err)
{
- struct cache_data *cache;
+ struct phonebook_data *data;
const char *query;
DBG("name %s", name);
@@ -1931,10 +1925,10 @@
return NULL;
}
- cache = g_new0(struct cache_data, 1);
- cache->entry_cb = entry_cb;
- cache->ready_cb = ready_cb;
- cache->user_data = user_data;
+ data = g_new0(struct phonebook_data, 1);
+ data->entry_cb = entry_cb;
+ data->ready_cb = ready_cb;
+ data->user_data = user_data;
- return query_tracker(query, 7, add_to_cache, cache, g_free, err);
+ return query_tracker(query, 7, add_to_cache, data, g_free, err);
}