]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Simplify %pM
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 24 Jan 2018 00:37:48 +0000 (17:37 -0700)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 25 Jan 2018 19:12:21 +0000 (12:12 -0700)
src/lib/util/print.c

index 0f2e9a9e209607276c374fa84481049efc94b7ad..3e0630b654cf58b60efd0ce68c4b0cec6343365f 100644 (file)
@@ -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':
                        {