aboutsummaryrefslogtreecommitdiff
path: root/lib/util/enum_to_name.c
blob: 70e3c2f363454639bee0a2ebcbac47ddb0967276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* 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;
}