Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
#include <syslog.h>
#include "log.h"
+#include "common.h"
#define PROTECT_ERRNO __attribute__((cleanup(_reset_errno))) __attribute((unused)) int _saved_errno = errno
}
int log_parse_level_name(const char *name) {
- int i;
+ unsigned i;
static const char *levels[] = {
[LOG_EMERG] = "emerg",
[LOG_ALERT] = "alert",
[LOG_DEBUG] = "debug",
};
- for (i = 0; i < sizeof(levels)/sizeof(levels[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(levels); i++)
if (strcmp(levels[i], name) == 0)
return i;
return -EINVAL;