Browse Source

Tiny fix to stringmap's run.c

Joey Adams 16 years ago
parent
commit
53b6a92e20
1 changed files with 4 additions and 2 deletions
  1. 4 2
      ccan/stringmap/test/run.c

+ 4 - 2
ccan/stringmap/test/run.c

@@ -68,6 +68,8 @@ static char *random_string(struct block_pool *bp) {
 struct test_entry {
 struct test_entry {
 	const char *str;
 	const char *str;
 	char *value;
 	char *value;
+		/* value is not a string, but a pointer to char marking that
+		   this key has been entered already. */
 };
 };
 
 
 static int by_str(const void *ap, const void *bp) {
 static int by_str(const void *ap, const void *bp) {
@@ -161,11 +163,11 @@ static int test_stringmap(size_t count, FILE *out) {
 			
 			
 			unique_count++;
 			unique_count++;
 		} else {
 		} else {
-			if (strcmp(i->value, map.last->value))
+			if (strcmp(i->str, map.last->str))
 				err("lookup returned incorrect string");
 				err("lookup returned incorrect string");
 			if (i->value != *node)
 			if (i->value != *node)
 				err("lookup returned incorrect value");
 				err("lookup returned incorrect value");
-			if (!**node)
+			if (!*i->value)
 				err("lookup returned bogus value");
 				err("lookup returned bogus value");
 		}
 		}
 	}
 	}