From: Ralph Ronnquist Date: Fri, 22 Jul 2022 05:42:29 +0000 (+1000) Subject: default to identity-hash X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=3b1aa91413c8e2753578079138de7e9f12e8010b;p=rrq%2Frrqmisc.git default to identity-hash --- diff --git a/typing/ItemKeyFun.c b/typing/ItemKeyFun.c index 81e4b9a..2b1d372 100644 --- a/typing/ItemKeyFun.c +++ b/typing/ItemKeyFun.c @@ -21,8 +21,7 @@ unsigned long ItemKeyFun_hashcode(void *this,void *key) { */ void *ItemKeyFun_itemkey(void *this,void *item) { ItemKeyFun *type = (ItemKeyFun*) this; - assert( type ); - return type->itemkey? type->itemkey( type, item ) : item; + return ( type && type->itemkey )? type->itemkey( type, item ) : item; } /** @@ -30,8 +29,7 @@ void *ItemKeyFun_itemkey(void *this,void *item) { */ int ItemKeyFun_haskey(void *this,void *item,void *key) { ItemKeyFun *type = (ItemKeyFun*) this; - assert( type ); - if ( type->haskey ) { + if ( type && type->haskey ) { return type->haskey( this, item, key ); } void *ikey = ItemKeyFun_itemkey( this, item ); @@ -45,8 +43,7 @@ int ItemKeyFun_haskey(void *this,void *item,void *key) { */ void ItemKeyFun_releasekey(void *this,void *key) { ItemKeyFun *type = (ItemKeyFun*) this; - assert( type ); - if ( type->releasekey ) { + if( type && type->releasekey ) { type->releasekey( type, key ); } } @@ -56,8 +53,7 @@ void ItemKeyFun_releasekey(void *this,void *key) { */ int ItemKeyFun_tostring(void *this,void *item,char *buffer,int limit) { ItemKeyFun *type = (ItemKeyFun*) this; - assert( type ); - if ( type->tostring ) { + if( type && type->tostring ) { return type->tostring( type, item, buffer, limit ); } void *key = ItemKeyFun_itemkey( this, item );