From d2d3901e13a7cd879611e1cf7f8a0de39eb125af Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Wed, 9 Jun 2021 14:37:57 -0400 Subject: Use seprintf for capList --- bounce.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/bounce.h b/bounce.h index 2010d45..e17f216 100644 --- a/bounce.h +++ b/bounce.h @@ -152,17 +152,15 @@ static inline enum Cap capParse(const char *list, const char *values[CapBits]) { static inline const char *capList(enum Cap caps, const char *values[CapBits]) { static char buf[1024]; buf[0] = '\0'; - size_t len = 0; + char *ptr = buf, *end = &buf[sizeof(buf)]; for (size_t i = 0; i < ARRAY_LEN(CapNames); ++i) { if (caps & (1 << i)) { - len += snprintf( - &buf[len], sizeof(buf) - len, - "%s%s%s%s", - (len ? " " : ""), CapNames[i], - (values && values[i] ? "=" : ""), - (values && values[i] ? values[i] : "") + ptr = seprintf( + ptr, end, "%s%s", (ptr > buf ? " " : ""), CapNames[i] ); - if (len >= sizeof(buf)) break; + if (values && values[i]) { + ptr = seprintf(ptr, end, "=%s", values[i]); + } } } return buf; -- cgit 1.4.1 h=1.1&follow=1'>log tree commit diff
path: root/Makefile (unfollow)
Commit message (Expand)Author
2020-01-14Remove note about usernames for pounceJune McEnroe
2020-01-14Reference IRCv3.1 SASL specJune McEnroe
2020-01-14Ensure ansi resets formatting and null-terminatesJune McEnroe
2020-01-14Implement IRC formatting to ANSI translationJune McEnroe
2020-01-14Add -b flag for live backupJune McEnroe
2020-01-14Add columnsize = 0 option to FTS indexJune McEnroe
2020-01-12Add option for client cert and SASL EXTERNALJune McEnroe
2020-01-12Add Linux.mkJune McEnroe
2020-01-11Fix unscoop dedup window syntaxJune McEnroe
2020-01-11Bump busy timeout to 10sJune McEnroehref='/litterbox/commit/scoop.c?h=1.1&id=fe029d311ef1abc6eba314930cbfbf71a48f1f13&follow=1'>Don't special case user being * in queriesJune McEnroe
It's a side-effect of imports that shouldn't surface elsewhere. Would be nice to have unscoop figure out how it can eliminate using * in more places.
2020-01-01Factor out hashing functionJune McEnroe
2020-01-01Add option for custom where expression to scoopJune McEnroe
2020-01-01Document ENVIRONMENT in scoop(1)June McEnroe
2019-12-31Add before and after optionsJune McEnroe
2019-12-31Add scoop IRC output formatJune McEnroe
2019-12-31Add scoop output format optionJune McEnroe
2019-12-31Refactor scoop formatters and group colored outputJune McEnroe
2019-12-31Add strftime format string optionJune McEnroe
2019-12-31Refactor binding in scoopJune McEnroe
2019-12-31Add option to group events by contextJune McEnroe
2019-12-31Add missing includeJune McEnroe
2019-12-31Use standout mode for highlightingJune McEnroe
2019-12-31Rewrite scoop(1) argument descriptionsJune McEnroe
2019-12-31Color both nicks in a changeJune McEnroe
2019-12-31Implement nick-colored outputJune McEnroe
2019-12-31Only enable highlighting on terminal outputJune McEnroe
2019-12-31Set up pager pipeJune McEnroe
2019-12-30Normalize date inputJune McEnroe
Mostly this just allows the use of 'now'.
2019-12-30Add initial rough version of scoopJune McEnroe
2019-12-30Join with USING wherever possibleJune McEnroe
2019-12-30Add -D flag to prospective scoop manualJune McEnroe
2019-12-30Order results by ID in outer query in litterboxJune McEnroe
2019-12-30Use X macro for Type enumJune McEnroe
2019-12-30Remove scoop -ABCJune McEnroe
I can almost get these to work with an inner and outer SQL query, but when contexts starts overlapping it becomes a disaster, so I'm leavin it out at least for now.
2019-12-30Add limit option for litterbox's search query interfaceJune McEnroe