X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Flib%2Fflags-v13.c;h=a8ed134d6618dba2e618b50ae4bf2606b48a65b1;hb=0e67039889a7f79e86cb64d397b9e83189b63358;hp=5b02a90ad5426043af1e21b3eae96bc73ab301f3;hpb=4df0e41e254d190fdbc8290ee38bfd31bd4342e8;p=util-vserver.git diff --git a/util-vserver/lib/flags-v13.c b/util-vserver/lib/flags-v13.c index 5b02a90..a8ed134 100644 --- a/util-vserver/lib/flags-v13.c +++ b/util-vserver/lib/flags-v13.c @@ -21,45 +21,33 @@ #endif #include "vserver.h" -#include "lib_internal/util-dimof.h" +#include "internal.h" +#include #include #include #define DECL(STR, VAL) { STR, sizeof(STR)-1, VAL } -static struct { - char const * const id; - size_t len; - unsigned char val; -} const FLAGVALUES[] = { +static struct Mapping_uint64 const VALUES[] = { DECL("fakeinit", S_CTX_INFO_INIT), }; uint_least64_t vc_text2flag(char const *str, size_t len) { - size_t i; - if (len==0) len=strlen(str); - - for (i=0; i0 && idx>0; i/=2) { - --idx; - if (val & i) return FLAGVALUES[idx].id; - } + ssize_t idx = utilvserver_text2value_uint64(val, + VALUES, DIM_OF(VALUES)); - return 0; + if (idx==-1) return 0; + else return VALUES[idx].id; }