Changeset 6078:8b870a495079 in roaraudio


Ignore:
Timestamp:
05/02/15 20:45:36 (4 years ago)
Author:
phi
Branch:
default
Message:

allow objects to be deleted within roar_kstore_foreach()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/kstore.c

    r6077 r6078  
    246246int                  roar_kstore_foreach(struct roar_kstore * store, int (*func)(void *obj, void *userdata), void * userdata) { 
    247247 size_t i; 
     248 void *obj; 
    248249 
    249250 if ( store == NULL || func == NULL ) { 
     
    255256  if ( store->kv[i].key == NULL ) 
    256257   continue; 
     258 
     259  obj = store->kv[i].value; 
     260 
    257261  if ( store->ref != NULL ) 
    258    store->ref(store->kv[i].value); 
    259   func(store->kv[i].value, userdata); 
     262   store->ref(obj); 
     263  func(obj, userdata); 
    260264  if ( store->unref != NULL ) 
    261    store->unref(store->kv[i].value); 
     265   store->unref(obj); 
    262266 } 
    263267 
Note: See TracChangeset for help on using the changeset viewer.