From: Alan T. DeKok Date: Thu, 25 Nov 2021 02:29:49 +0000 (-0500) Subject: update pure flags X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7501253d71545644a8eb65fca1a599589eb798d;p=thirdparty%2Ffreeradius-server.git update pure flags we default to pure, and various other things will over-ride the flag if necessary. e.g. impure functions will set the flag to false, as will attribute references. --- diff --git a/src/lib/unlang/xlat_tokenize.c b/src/lib/unlang/xlat_tokenize.c index 6e881bc944a..2e4a11883d4 100644 --- a/src/lib/unlang/xlat_tokenize.c +++ b/src/lib/unlang/xlat_tokenize.c @@ -119,6 +119,7 @@ static inline CC_HINT(always_inline) xlat_exp_t *xlat_exp_alloc_null(TALLOC_CTX xlat_exp_t *node; MEM(node = talloc_zero(ctx, xlat_exp_t)); + node->flags.pure = true; /* everything starts pure */ return node; } @@ -139,11 +140,13 @@ static inline CC_HINT(always_inline) xlat_exp_t *xlat_exp_alloc(TALLOC_CTX *ctx, node = xlat_exp_alloc_null(ctx); node->type = type; - if (in) node->fmt = talloc_bstrndup(node, in, inlen); + node->flags.pure = true; /* everything starts pure */ + + if (!in) return node; + + node->fmt = talloc_bstrndup(node, in, inlen); if (type == XLAT_BOX) { - node->flags.pure = true; /* value boxes are always pure */ - node->flags.needs_async = false; /* value boxes are always non-async */ fr_value_box_strdup_shallow(&node->data, NULL, node->fmt, false); } @@ -158,11 +161,6 @@ static inline CC_HINT(always_inline) xlat_exp_t *xlat_exp_alloc(TALLOC_CTX *ctx, static inline CC_HINT(always_inline) void xlat_exp_set_type(xlat_exp_t *node, xlat_type_t type) { node->type = type; - - if (type == XLAT_BOX) { - node->flags.pure = true; /* value boxes are always pure */ - node->flags.needs_async = false; /* value boxes are always non-async */ - } } #if 0