From 81c63b0eed39432878f78727f60a1e7499645199 Mon Sep 17 00:00:00 2001 From: Yves-Alexis Perez Date: Fri, 11 Jul 2014 07:23:31 +0200 Subject: Imported Upstream version 5.2.0 --- src/libstrongswan/utils/enum.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/libstrongswan/utils/enum.c') diff --git a/src/libstrongswan/utils/enum.c b/src/libstrongswan/utils/enum.c index 3db9a34e0..f96fe2989 100644 --- a/src/libstrongswan/utils/enum.c +++ b/src/libstrongswan/utils/enum.c @@ -17,6 +17,7 @@ #include #include +#include #include "enum.h" @@ -39,7 +40,7 @@ char *enum_to_name(enum_name_t *e, int val) /** * See header. */ -int enum_from_name(enum_name_t *e, char *name) +bool enum_from_name_as_int(enum_name_t *e, const char *name, int *val) { do { @@ -49,12 +50,13 @@ int enum_from_name(enum_name_t *e, char *name) { if (name && strcaseeq(name, e->names[i])) { - return e->first + i; + *val = e->first + i; + return TRUE; } } } while ((e = e->next)); - return -1; + return FALSE; } /** -- cgit v1.2.3