From 25b6fdd66ac5144610e805d6476b4286c09e9a04 Mon Sep 17 00:00:00 2001 From: "Alan T. DeKok" Date: Fri, 17 May 2013 11:26:06 -0400 Subject: [PATCH] A better way of getting empty alternations --- src/main/xlat.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/xlat.c b/src/main/xlat.c index fd0814f..58e52e6 100644 --- a/src/main/xlat.c +++ b/src/main/xlat.c @@ -586,10 +586,13 @@ static ssize_t xlat_tokenize_alternation(TALLOC_CTX *ctx, char *fmt, xlat_exp_t * Allow the RHS to be empty as a special case. */ if (*p == '}') { - *p = '\0'; - slen = xlat_tokenize_literal(node, p, &node->alternate, true, error); - rad_assert(slen == 0); - p++; + /* + * Hack up an empty string. + */ + node->alternate = talloc_zero(node, xlat_exp_t); + node->alternate->type = XLAT_LITERAL; + node->alternate->fmt = talloc_strdup(node->alternate, ""); + *(p++) = '\0'; } else { slen = xlat_tokenize_literal(node, p, &node->alternate, true, error); -- 2.1.4