shithub: mc

Download patch

ref: 3d20a6d5e0c554e9f3d0d3f504f4dfb28901ebb7
parent: ce9623eb0bebca8f485f9a49276b23a0feff677b
author: Ori Bernstein <[email protected]>
date: Thu Oct 10 10:50:29 EDT 2013

Allow streq to handle null strings.

--- a/parse/htab.c
+++ b/parse/htab.c
@@ -214,7 +214,11 @@
 
 int streq(void *a, void *b)
 {
-    return a == b || !strcmp(a, b);
+    if (a == b)
+        return 1;
+    if (a == NULL || b == NULL)
+        return 0;
+    return !strcmp(a, b);
 }
 
 ulong ptrhash(void *key)