summary refs log tree commit diff
path: root/chat.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-06-07 00:09:58 -0400
committerJune McEnroe <june@causal.agency>2021-06-09 11:56:35 -0400
commite066a954f5b638103102250d87661d91f3c9f3f0 (patch)
treeac6694692bcea35ca8b0a29318cbbfcf5a849428 /chat.h
parentAdd seprintf (diff)
downloadcatgirl-e066a954f5b638103102250d87661d91f3c9f3f0.tar.gz
catgirl-e066a954f5b638103102250d87661d91f3c9f3f0.zip
Replace catf with seprintf
Diffstat (limited to 'chat.h')
-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;
 	}
 }