Changeset 3325

Show
Ignore:
Timestamp:
05/05/08 01:05:16 (5 months ago)
Author:
gcobb
Message:

Reimplement opensync_hashtable.c:callback_check_deleted

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ChangeLog

    r3307 r3325  
     12008-05-04  Graham Cobb  <g+770@cobb.uk.net> 
     2 
     3        * opensync/helper/opensync_hashtable.c (osync_hashtable_get_deleted):  
     4        Reimplement change below to avoid local function declaration, which does not 
     5        work on suncc.  Use user_data parameter on callback_check_deleted instead. 
     6 
    172008-05-03  Graham Cobb  <g+770@cobb.uk.net> 
    28 
  • trunk/opensync/helper/opensync_hashtable.c

    r3313 r3325  
    495495 *  
    496496 */ 
     497struct callback_data { 
     498  OSyncList *deleted_entries; 
     499  OSyncHashTable *table; 
     500}; 
     501static void callback_check_deleted(gpointer key, gpointer value, gpointer user_data) 
     502{ 
     503        struct callback_data *cbdata = user_data; 
     504        if (!g_hash_table_lookup(cbdata->table->reported_entries, key)) 
     505          cbdata->deleted_entries = osync_list_prepend(cbdata->deleted_entries, key); 
     506} 
    497507OSyncList *osync_hashtable_get_deleted(OSyncHashTable *table) 
    498508{ 
     
    502512        osync_trace(TRACE_ENTRY, "%s(%p)", __func__, table); 
    503513 
    504         OSyncList *deleted_entries = NULL; 
    505  
    506         void callback_check_deleted(gpointer key, gpointer value, gpointer user_data) 
    507           { 
    508             if (!g_hash_table_lookup(table->reported_entries, key)) 
    509               deleted_entries = osync_list_prepend(deleted_entries, key); 
    510           } 
    511  
    512         g_hash_table_foreach(table->db_entries, callback_check_deleted, NULL); 
    513  
    514         osync_trace(TRACE_EXIT, "%s: %p", __func__, deleted_entries); 
    515         return deleted_entries; 
     514        struct callback_data cbdata = {NULL, table}; 
     515 
     516        g_hash_table_foreach(table->db_entries, callback_check_deleted, &cbdata); 
     517 
     518        osync_trace(TRACE_EXIT, "%s: %p", __func__, cbdata.deleted_entries); 
     519        return cbdata.deleted_entries; 
    516520} 
    517521