From: Arran Cudbard-Bell Date: Mon, 15 Mar 2021 20:20:58 +0000 (+0000) Subject: Better initialisation X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ef78ff64f7417e2c4f307691225cff23e9a324c2;p=thirdparty%2Ffreeradius-server.git Better initialisation --- diff --git a/src/lib/unlang/xlat_builtin.c b/src/lib/unlang/xlat_builtin.c index 12b0f48c921..0197df9e6cd 100644 --- a/src/lib/unlang/xlat_builtin.c +++ b/src/lib/unlang/xlat_builtin.c @@ -350,15 +350,17 @@ xlat_t const *xlat_register(TALLOC_CTX *ctx, char const *name, xlat_func_t func, /* * Doesn't exist. Create it. */ - c = talloc_zero(ctx, xlat_t); - c->name = talloc_typed_strdup(c, name); + c = talloc(ctx, xlat_t); + *c = (xlat_t){ + .name = talloc_typed_strdup(c, name), + .func = { + .async = func + }, + .type = XLAT_FUNC_NORMAL, + .needs_async = needs_async, /* this function may yield */ + .input_type = XLAT_INPUT_UNPROCESSED /* set default - will be overridden if args are registered */ + }; talloc_set_destructor(c, _xlat_func_talloc_free); - - c->func.async = func; - c->type = XLAT_FUNC_NORMAL; - c->needs_async = needs_async; /* this function may yield */ - c->input_type = XLAT_INPUT_UNPROCESSED; /* set default - will be overridden if args are registered */ - DEBUG3("%s: %s", __FUNCTION__, c->name); if (!rbtree_insert(xlat_root, c)) {