From 71eefb62728cb0998aff22d187eedd62df0211e9 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Wed, 6 Jul 2022 18:59:01 -0300 Subject: [PATCH] Update to new %M API Doc still references the old API and mg_rprintf() is not yet documented --- examples/huge-response/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/huge-response/main.c b/examples/huge-response/main.c index 0f1cbc4c..7cd7eb0a 100644 --- a/examples/huge-response/main.c +++ b/examples/huge-response/main.c @@ -27,15 +27,14 @@ static long getparam(struct mg_http_message *hm, const char *json_path) { return dv; } -static size_t printdata(char *buf, size_t len, va_list *ap) { +static size_t printdata(void (*out)(char, void *), void *ptr, va_list *ap) { unsigned start = va_arg(*ap, unsigned); unsigned max = start + CHUNK_SIZE; const char *comma = ""; size_t n = 0; if (max > DATA_SIZE) max = DATA_SIZE; while (start < max) { - n += mg_snprintf(buf ? buf + n : 0, len < n ? 0 : len - n, "%s%d", comma, - s_data[start]); + n += mg_rprintf(out, ptr, "%s%d", comma, s_data[start]); comma = ","; start++; }