Changeset 6075:8939249a197e in roaraudio


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

added foreach like function to kstore

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/kstore.h

    r6052 r6075  
    5252const char *         roar_kstore_name(struct roar_kstore * store, const void * obj); 
    5353 
     54int                  roar_kstore_foreach(struct roar_kstore * store, int (*func)(void *obj, void *userdata), void * userdata); 
     55 
    5456// aliases: 
    5557#define roar_kstore_new_connection(len) roar_kstore_new((len),                \ 
  • libroar/kstore.c

    r6052 r6075  
    244244} 
    245245 
     246int                  roar_kstore_foreach(struct roar_kstore * store, int (*func)(void *obj, void *userdata), void * userdata) { 
     247 size_t i; 
     248 
     249 if ( store == NULL || func == NULL ) { 
     250  roar_err_set(ROAR_ERROR_FAULT); 
     251  return -1; 
     252 } 
     253 
     254 for (i = 0; i < store->len; i++) { 
     255  func(store->kv[i].value, userdata); 
     256 } 
     257 
     258 return 0; 
     259} 
     260 
    246261//ll 
Note: See TracChangeset for help on using the changeset viewer.