Skip to content
Permalink
Browse files

allow sibling STRUCT definitions, one after the other.

In which case we unwind the stack until we find the correct
parent.
  • Loading branch information
alandekok committed Aug 13, 2019
1 parent 1e9ab75 commit 2073f61e6842ce0962178e0d20d87ad7cb264f32
Showing with 15 additions and 0 deletions.
  1. +15 −0 src/lib/util/dict.c
@@ -4623,6 +4623,21 @@ static int dict_read_process_struct(dict_from_file_ctx_t *ctx, char **argv, int
*/
if (!fr_cond_assert(parent->parent->type == FR_TYPE_STRUCT)) return -1;

/*
* The attribute in the current stack frame is NOT the
* enclosing "struct": unwind until we do find the parent.
*/
if (ctx->stack[ctx->stack_depth].da != parent->parent) {
int i;

for (i = ctx->stack_depth - 1; i > 0; i--) {
if (ctx->stack[i].da == parent->parent) {
ctx->stack_depth = i;
break;
}
}
}

/*
* The attribute in the current stack frame MUST be the
* enclosing "struct".

0 comments on commit 2073f61

Please sign in to comment.
You can’t perform that action at this time.