warn of null keys in ll

This commit is contained in:
Ron Pedde 2006-03-17 08:49:22 +00:00
parent 779a139c9d
commit d5da21ae85
2 changed files with 11 additions and 0 deletions

View File

@ -125,6 +125,11 @@ int ll_add_ll(LL *pl, char *key, LL *pnew) {
int _ll_add_item(LL *pl, char *key, void* vpval, int ival, int type) {
LL_ITEM *pli;
if(!key) {
DPRINTF(E_LOG,L_MISC,"_ll_add_item: passed null key\n");
return LL_E_BADPARAM;
}
if(pl->flags & LL_FLAG_NODUPS) {
if(ll_fetch_item(pl,key))
return LL_E_DUP;
@ -146,6 +151,11 @@ int _ll_add_item(LL *pl, char *key, void* vpval, int ival, int type) {
pli->value.as_ll = (LL *)vpval;
break;
case LL_TYPE_STRING:
if(!vpval) {
DPRINTF(E_LOG,L_MISC,"_ll_add_item: passed null value\n");
free(pli);
return LL_E_BADPARAM;
}
pli->value.as_string = strdup((char*)vpval);
break;
default:

View File

@ -31,6 +31,7 @@
#define LL_E_MALLOC 1
#define LL_E_NOKEY 2
#define LL_E_DUP 3
#define LL_E_BADPARAM 4
#define LL_FLAG_HONORCASE 1 /** Make keys case sensitive */
#define LL_FLAG_HEADINSERT 2 /** Insert at head, rather than tail */