Changeset 6079:a246d802e69d in roaraudio


Ignore:
Timestamp:
05/31/15 00:03:34 (4 years ago)
Author:
phi
Branch:
default
Message:

added roar_kstore_length()

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/kstore.h

    r6075 r6079  
    5454int                  roar_kstore_foreach(struct roar_kstore * store, int (*func)(void *obj, void *userdata), void * userdata); 
    5555 
     56ssize_t              roar_kstore_length(struct roar_kstore * store); 
     57 
    5658// aliases: 
    5759#define roar_kstore_new_connection(len) roar_kstore_new((len),                \ 
  • libroar/kstore.c

    r6078 r6079  
    269269} 
    270270 
     271ssize_t              roar_kstore_length(struct roar_kstore * store) { 
     272 ssize_t ret = 0; 
     273 size_t i; 
     274 
     275 if ( store == NULL ) { 
     276  roar_err_set(ROAR_ERROR_FAULT); 
     277  return -1; 
     278 } 
     279 
     280 for (i = 0; i < store->len; i++) 
     281  if ( store->kv[i].key != NULL ) 
     282   ret++; 
     283 
     284 return ret; 
     285} 
     286 
    271287//ll 
Note: See TracChangeset for help on using the changeset viewer.