Commit 6d7edfce authored by Federico G. Schwindt's avatar Federico G. Schwindt Committed by Lasse Karstensen

Correct ENUM handling in object constructors

Discussed with phk@.  Fix confirmed by geoff@.

Fixes #1844.
parent b4359dbb
......@@ -203,9 +203,14 @@ parse_new(struct vcc *tl)
s_obj = p;
p += strlen(p) + 1;
s_init = p;
while (p[0] != '\0' || p[1] != '\0')
/*
* Check for the end marked (\0\0) followed by s(truct) to avoid
* matching an ENUM half-way through and generating illegal C code.
*/
while (p[0] != '\0' || p[1] != '\0' || p[2] != 's')
p++;
p += 2;
AZ(strncmp(p, "struct vmod_", 12));
s_struct = p;
p += strlen(p) + 1;
s_fini = p + strlen(p) + 1;
......
......@@ -71,7 +71,7 @@ $Function BACKEND no_backend()
Fails at backend selection
$Object obj(STRING)
$Object obj(STRING, ENUM { one, two, three } number="one")
Test object
......
......@@ -43,13 +43,14 @@ struct vmod_debug_obj {
VCL_VOID
vmod_obj__init(VRT_CTX, struct vmod_debug_obj **op,
const char *vcl_name, VCL_STRING s)
const char *vcl_name, VCL_STRING s, VCL_ENUM e)
{
struct vmod_debug_obj *o;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
(void)vcl_name;
(void)s;
(void)e;
AN(op);
AZ(*op);
ALLOC_OBJ(o, VMOD_DEBUG_OBJ_MAGIC);
......
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