diff options
author | June McEnroe <june@causal.agency> | 2021-06-07 00:09:58 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2021-06-09 11:56:35 -0400 |
commit | e066a954f5b638103102250d87661d91f3c9f3f0 (patch) | |
tree | ac6694692bcea35ca8b0a29318cbbfcf5a849428 /chat.h | |
parent | Add seprintf (diff) | |
download | catgirl-e066a954f5b638103102250d87661d91f3c9f3f0.tar.gz catgirl-e066a954f5b638103102250d87661d91f3c9f3f0.zip |
Replace catf with seprintf
Diffstat (limited to 'chat.h')
-rw-r--r-- | chat.h | 6 |
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; } } |