Export mg_pfn_iobuf_noresize

This commit is contained in:
cpq committed 2026-01-24 11:32:32 +00:00
1 parent 46ad050cea
commit e86d4da129
4 files changed
+11 -9

No files matched your search

+3 -3
View File
@@ -1,5 +1,5 @@
#include "printf.h"
#include "fmt.h"
#include "printf.h"
#include "util.h"
size_t mg_queue_printf(struct mg_queue *q, const char *fmt, ...) {
@@ -29,7 +29,7 @@ static void mg_pfn_iobuf_private(char ch, void *param, bool expand) {
}
}
static void mg_putchar_iobuf_static(char ch, void *param) {
void mg_pfn_iobuf_noresize(char ch, void *param) {
mg_pfn_iobuf_private(ch, param, false);
}
@@ -41,7 +41,7 @@ size_t mg_vsnprintf(char *buf, size_t len, const char *fmt, va_list *ap) {
struct mg_iobuf io = {0, 0, 0, 0};
size_t n;
io.buf = (uint8_t *) buf, io.size = len;
n = mg_vxprintf(mg_putchar_iobuf_static, &io, fmt, ap);
n = mg_vxprintf(mg_pfn_iobuf_noresize, &io, fmt, ap);
if (n < len) buf[n] = '\0';
return n;
}
+3 -2
View File
@@ -23,8 +23,9 @@ size_t mg_print_mac(void (*out)(char, void *), void *arg, va_list *ap);
size_t mg_print_l2addr(void (*out)(char, void *), void *arg, va_list *ap);
// Various output functions
void mg_pfn_iobuf(char ch, void *param); // param: struct mg_iobuf *
void mg_pfn_stdout(char c, void *param); // param: ignored
void mg_pfn_iobuf(char ch, void *param); // param: struct mg_iobuf *
void mg_pfn_iobuf_noresize(char ch, void *param); // param: struct mg_iobuf *
void mg_pfn_stdout(char c, void *param); // param: ignored
// A helper macro for printing JSON: mg_snprintf(buf, len, "%m", MG_ESC("hi"))
#define MG_ESC(str) mg_print_esc, 0, (str)