From: Arran Cudbard-Bell Date: Wed, 24 Jan 2018 00:37:48 +0000 (-0700) Subject: Simplify %pM X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2649e87f0ef7293c816357d4a32e0e093df6f1e9;p=thirdparty%2Ffreeradius-server.git Simplify %pM --- diff --git a/src/lib/util/print.c b/src/lib/util/print.c index 0f2e9a9e209..3e0630b654c 100644 --- a/src/lib/util/print.c +++ b/src/lib/util/print.c @@ -694,34 +694,9 @@ char *fr_vasprintf(TALLOC_CTX *ctx, char const *fmt, va_list ap) break; case 'M': - { - fr_value_box_t const *in = va_arg(ap_q, fr_value_box_t const *); - char *tmp, *n; - - subst = talloc_strdup(NULL, ""); - do { - /* - * Allocations that are not part of the output - * string need to occur in the NULL ctx so we don't fragment - * any pool associated with it. - */ - tmp = fr_value_box_asprint(NULL, in, '"'); - if (!tmp) { - merror: - talloc_free(subst); - talloc_free(out); - va_end(ap_p); - va_end(ap_q); - return NULL; - } - n = talloc_buffer_append_buffer(subst, tmp); - talloc_free(tmp); - if (!n) goto merror; - subst = n; - } while ((in = in->next)); - + subst = fr_value_box_list_asprint(NULL, + va_arg(ap_q, fr_value_box_t const *), NULL, '"'); goto do_splice; - } case 'H': {