X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=libtu%2Fstringstore.c;h=3c5b7a1ec238d615fb8e71f8786b71c9bf765a8b;hb=ae4260bb64817c11f9a7140324cd3e3ba113e297;hp=5529820666cd46d27f7d25b01d9ce35070ca54dd;hpb=803afbc1cd633f6c025bcd9537e9b7e9aedadd0d;p=ion3.git diff --git a/libtu/stringstore.c b/libtu/stringstore.c index 5529820..3c5b7a1 100644 --- a/libtu/stringstore.c +++ b/libtu/stringstore.c @@ -40,7 +40,7 @@ static int cmp(const void *d_, const char *nodekey) return (res!=0 ? res - : (nodekey[d->len]=='\0' ? 0 : 1)); + : (nodekey[d->len]=='\0' ? 0 : -1)); } @@ -105,6 +105,9 @@ StringId stringstore_alloc_n(const char *str, uint l) StringId stringstore_alloc(const char *str) { + if(str==NULL) + return STRINGID_NONE; + return stringstore_alloc_n(str, strlen(str)); } @@ -113,10 +116,8 @@ void stringstore_free(StringId id) { Rb_node node=(Rb_node)id; - if(node==NULL){ - warn("Attempt to free un-allocated string from stringstore."); + if(node==NULL) return; - } if(node->v.ival<=0){ warn("Stringstore reference count corrupted.");