Commit 38f712a6 authored by Nils Goroll's avatar Nils Goroll

use a table file for vmod enum to c enum

parent 328cea21
...@@ -10,7 +10,8 @@ libvmod_blob_la_SOURCES = \ ...@@ -10,7 +10,8 @@ libvmod_blob_la_SOURCES = \
hex.c \ hex.c \
url.c \ url.c \
wb.h \ wb.h \
wb.c wb.c \
tbl_encodings.h
base64.o: base64.c base64.h base64.o: base64.c base64.h
......
VMODENUM(BASE64)
VMODENUM(BASE64URL)
VMODENUM(BASE64URLNOPAD)
VMODENUM(HEX)
VMODENUM(IDENTITY)
VMODENUM(URL)
#undef VMODENUM
...@@ -119,12 +119,8 @@ static const struct vmod_priv null_blob[1] = ...@@ -119,12 +119,8 @@ static const struct vmod_priv null_blob[1] =
static enum encoding static enum encoding
parse_encoding(VCL_ENUM e) parse_encoding(VCL_ENUM e)
{ {
if (e == vmod_enum_BASE64) return(BASE64); #define VMODENUM(n) if (e == vmod_enum_ ## n) return(n);
if (e == vmod_enum_BASE64URL) return(BASE64URL); #include "tbl_encodings.h"
if (e == vmod_enum_BASE64URLNOPAD) return(BASE64URLNOPAD);
if (e == vmod_enum_HEX) return(HEX);
if (e == vmod_enum_IDENTITY) return(IDENTITY);
if (e == vmod_enum_URL) return(URL);
WRONG("illegal encoding enum"); WRONG("illegal encoding enum");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment