From e066a954f5b638103102250d87661d91f3c9f3f0 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Mon, 7 Jun 2021 00:09:58 -0400 Subject: Replace catf with seprintf --- chat.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'chat.h') diff --git a/chat.h b/chat.h index e9bee8b..b82c4c9 100644 --- a/chat.h +++ b/chat.h @@ -117,11 +117,13 @@ static inline size_t styleParse(struct Style *style, const char **str) { return strcspn(*str, (const char[]) { B, C, O, R, I, U, '\0' }); } -static inline void styleStrip(struct Cat *cat, const char *str) { +static inline void styleStrip(char *buf, size_t cap, const char *str) { + *buf = '\0'; + char *ptr = buf, *end = &buf[cap]; struct Style style = StyleDefault; while (*str) { size_t len = styleParse(&style, &str); - catf(cat, "%.*s", (int)len, str); + ptr = seprintf(ptr, end, "%.*s", (int)len, str); str += len; } } -- cgit 1.4.1-2-gfad0