| 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 |
33 |
| 34 const char *stringintmap_reverse_value(const StringIntMap *map, int value, |
34 const char *stringintmap_key(const StringIntMap *map, int value, |
| 35 const char *dflt) |
35 const char *dflt) |
| 36 { |
36 { |
| 37 int i; |
37 int i; |
| 38 |
38 |
| 39 for(i=0; map[i].string!=NULL; ++i){ |
39 for(i=0; map[i].string!=NULL; ++i){ |
| 40 if(map[i].value==value){ |
40 if(map[i].value==value){ |