ssize_t slen;
xlat_exp_t *node = NULL, *unary = NULL;
xlat_t *func = NULL;
- char const *fmt = NULL;
fr_sbuff_t our_in = FR_SBUFF(in);
char c = '\0';
* we allocate.
*/
if (fr_sbuff_next_if_char(&our_in, '!')) { /* unary not */
- fmt = "!";
func = xlat_func_find("unary_not", 9);
fr_assert(func != NULL);
c = '!';
}
else if (fr_sbuff_next_if_char(&our_in, '-')) { /* unary minus */
- fmt = "-";
func = xlat_func_find("unary_minus", 11);
fr_assert(func != NULL);
c = '-';
}
else if (fr_sbuff_next_if_char(&our_in, '~')) { /* unary complement */
- fmt = "~";
func = xlat_func_find("unary_complement", 16);
fr_assert(func != NULL);
c = '~';
}
/*
- * Tokenize_field may reset this.
+ * Tokenize_field may reset this if the operation is wrapped inside of another expression.
*/
*out_c = c;
MEM(unary = xlat_exp_alloc(head, XLAT_FUNC, func->name, strlen(func->name)));
MEM(unary->call.args = xlat_exp_head_alloc(unary));
- unary->fmt = fmt;
+ unary->fmt = fr_tokens[func->token];
unary->call.func = func;
unary->flags = func->flags;