more progress in new ktv storage
FossilOrigin-Name: a2c26a366de1946feb707439302b22de2e3d02f7621d0834fdf242852b28639c
This commit is contained in:
23
src/cw/cw_ktv_get.c
Normal file
23
src/cw/cw_ktv_get.c
Normal file
@ -0,0 +1,23 @@
|
||||
#include "ktv.h"
|
||||
#include "mavl.h"
|
||||
|
||||
cw_KTV_t * cw_ktv_get(mavl_t ktv, const char *key, const cw_Type_t * type)
|
||||
{
|
||||
cw_KTV_t search, *result;
|
||||
/* we can safely cast from const char * to char *, because
|
||||
* we never will use the search varaiable to store ktv values */
|
||||
search.key=(char*)key;
|
||||
|
||||
result = mavl_get(ktv,&search);
|
||||
if (result == NULL){
|
||||
return NULL;
|
||||
}
|
||||
if (type == NULL){
|
||||
return result;
|
||||
}
|
||||
if (strcmp(type->name,result->type->name)==0){
|
||||
return result;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
Reference in New Issue
Block a user