diff options
author | Yves-Alexis Perez <corsac@debian.org> | 2014-07-11 07:23:31 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@debian.org> | 2014-07-11 07:23:31 +0200 |
commit | 81c63b0eed39432878f78727f60a1e7499645199 (patch) | |
tree | 82387d8fecd1c20788fd8bd784a9b0bde091fb6b /src/libstrongswan/utils/enum.c | |
parent | c5ebfc7b9c16551fe825dc1d79c3f7e2f096f6c9 (diff) | |
download | vyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.tar.gz vyos-strongswan-81c63b0eed39432878f78727f60a1e7499645199.zip |
Imported Upstream version 5.2.0
Diffstat (limited to 'src/libstrongswan/utils/enum.c')
-rw-r--r-- | src/libstrongswan/utils/enum.c | 8 |
1 files changed, 5 insertions, 3 deletions
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 <stdio.h> #include <library.h> +#include <utils/utils.h> #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; } /** |