1
0
Fork 0
mirror of https://github.com/pygos/init.git synced 2024-05-18 19:56:14 +02:00
init/lib/util/enum_to_name.c

17 lines
261 B
C
Raw Normal View History

/* SPDX-License-Identifier: ISC */
#include <string.h>
#include "util.h"
const char *enum_to_name(const enum_map_t *map, int value)
{
size_t i;
for (i = 0; map[i].name != NULL; ++i) {
if (map[i].value == value)
return map[i].name;
}
return NULL;
}