about summary refs log tree commit diff
path: root/chat.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--chat.h6
1 files changed, 4 insertions, 2 deletions
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;
 	}
 }