- fixed bug in mapping_find
This commit is contained in:
@@ -28,13 +28,13 @@
|
|||||||
char *mapping_find(mapping_t * maps, int value)
|
char *mapping_find(mapping_t * maps, int value)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (maps[i].value > MAPPING_END)
|
while (maps[i].value != MAPPING_END)
|
||||||
{
|
{
|
||||||
i++;
|
|
||||||
if (maps[i].value == value)
|
if (maps[i].value == value)
|
||||||
{
|
{
|
||||||
return maps[i].string;
|
return maps[i].string;
|
||||||
}
|
}
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
return "INVALID MAPPING";
|
return "INVALID MAPPING";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#define DEFINITIONS_H_
|
#define DEFINITIONS_H_
|
||||||
|
|
||||||
|
|
||||||
#define MAPPING_END -1
|
#define MAPPING_END (-1)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mapping entry, where enum-to-string mappings are stored
|
* @brief mapping entry, where enum-to-string mappings are stored
|
||||||
|
|||||||
Reference in New Issue
Block a user