map.c

changeset 51
2d95d77aa954
parent 49
755bdb97a607
child 53
f8f9366b359c
--- a/map.c	Sat Apr 05 22:24:03 2003 +0200
+++ b/map.c	Sat Apr 05 22:32:55 2003 +0200
@@ -15,9 +15,16 @@
 	
 	for(i=0; map[i].string!=NULL; i++){
 		if(strcmp(str, map[i].string)==0)
-			return map[i].value;
+			return i;
 	}
 	
 	return -1;
 }
 
+
+int stringintmap_value(const StringIntMap *map, const char *str, int dflt)
+{
+    int i=stringintmap_ndx(map, str);
+	return (i==-1 ? dflt : map[i].value); 
+}
+

mercurial