map.c

changeset 75
725a7187c6ff
parent 70
e866dc825481
child 76
58280b944cda
equal deleted inserted replaced
74:60cb620a0341 75:725a7187c6ff
28 { 28 {
29 int i=stringintmap_ndx(map, str); 29 int i=stringintmap_ndx(map, str);
30 return (i==-1 ? dflt : map[i].value); 30 return (i==-1 ? dflt : map[i].value);
31 } 31 }
32 32
33
34 const char *stringintmap_reverse_value(const StringIntMap *map, int value,
35 const char *dflt)
36 {
37 int i;
38
39 for(i=0; map[i].string!=NULL; ++i){
40 if(map[i].value==value){
41 return map[i].string;
42 }
43 }
44
45 return dflt;
46
47 }

mercurial