char const *p = name;
char const *q;
- /* This should never be a NULL pointer */
- fr_assert(name);
-
/*
* Try and determine the end of the token
*/
MEM(vpt = talloc(ctx, tmpl_t));
len = fr_value_box_aprint(vpt, &name, data, fr_value_escape_by_quote[quote]);
+ if (len < 0) {
+ error:
+ talloc_free(vpt);
+ return -1;
+ }
+
tmpl_init_shallow(vpt, TMPL_TYPE_DATA, quote, name, len);
if (steal) {
- if (fr_value_box_steal(vpt, tmpl_value(vpt), data) < 0) {
- talloc_free(vpt);
- return -1;
- }
+ if (fr_value_box_steal(vpt, tmpl_value(vpt), data) < 0) goto error;
} else {
- if (fr_value_box_copy(vpt, tmpl_value(vpt), data) < 0) {
- talloc_free(vpt);
- return -1;
- }
+ if (fr_value_box_copy(vpt, tmpl_value(vpt), data) < 0) goto error;
}
*out = vpt;
ssize_t fr_value_box_print_quoted(fr_sbuff_t *out, fr_value_box_t const *data, fr_token_t quote) CC_HINT(nonnull);
-static inline size_t fr_value_box_aprint(TALLOC_CTX *ctx, char **out,
- fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules)
-{
- SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print, data, e_rules)
-}
+static inline fr_slen_t fr_value_box_aprint(TALLOC_CTX *ctx, char **out,
+ fr_value_box_t const *data, fr_sbuff_escape_rules_t const *e_rules)
+ SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print, data, e_rules)
+
+static inline fr_slen_t fr_value_box_aprint_quoted(TALLOC_CTX *ctx, char **out,
+ fr_value_box_t const *data, fr_token_t quote)
+ SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print_quoted, data, quote)
-static inline size_t fr_value_box_aprint_quoted(TALLOC_CTX *ctx, char **out,
- fr_value_box_t const *data, fr_token_t quote)
-{
- SBUFF_OUT_TALLOC_FUNC_NO_LEN_DEF(fr_value_box_print_quoted, data, quote)
-}
/** @} */
/** @name Hashing
*