Better handling of STRINGID_NONE

Tue, 20 Feb 2007 00:18:18 +0100

author
Tuomo Valkonen <tuomov@iki.fi>
date
Tue, 20 Feb 2007 00:18:18 +0100
changeset 108
2b4dd5f948bc
parent 107
da2a985da6ee
child 109
96a557abc364

Better handling of STRINGID_NONE

stringstore.c file | annotate | diff | comparison | revisions
--- a/stringstore.c	Mon Jan 29 15:11:39 2007 +0100
+++ b/stringstore.c	Tue Feb 20 00:18:18 2007 +0100
@@ -105,6 +105,9 @@
 
 StringId stringstore_alloc(const char *str)
 {
+    if(str==NULL)
+        return STRINGID_NONE;
+    
     return stringstore_alloc_n(str, strlen(str));
 }
 
@@ -113,10 +116,8 @@
 {
     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.");

mercurial