From a8264f31e02b9ec064e6b3d959c50b854861f0fb Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Sun, 8 Nov 2020 15:07:13 -0500 Subject: Remove static buffer from capList --- handle.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/handle.c b/handle.c index 58510a2..28824d4 100644 --- a/handle.c +++ b/handle.c @@ -63,16 +63,13 @@ static enum Cap capParse(const char *list) { return caps; } -static const char *capList(enum Cap caps) { - static char buf[1024]; - buf[0] = '\0'; - struct Cat cat = { buf, sizeof(buf), 0 }; +static const char *capList(struct Cat *cat, enum Cap caps) { for (size_t i = 0; i < ARRAY_LEN(CapNames); ++i) { if (caps & (1 << i)) { - catf(&cat, "%s%s", (buf[0] ? " " : ""), CapNames[i]); + catf(cat, "%s%s", (cat->len ? " " : ""), CapNames[i]); } } - return buf; + return cat->buf; } static void require(struct Message *msg, bool origin, uint len) { @@ -143,7 +140,9 @@ static void handleCap(struct Message *msg) { caps &= ~CapConsumer; } if (caps) { - ircFormat("CAP REQ :%s\r\n", capList(caps)); + char buf[512] = ""; + struct Cat cat = { buf, sizeof(buf), 0 }; + ircFormat("CAP REQ :%s\r\n", capList(&cat, caps)); } else { if (!(self.caps & CapSASL)) ircFormat("CAP END\r\n"); } -- cgit 1.4.0 ?id=70267f3b008455c16a669122dfabfd2494b0a83d&follow=1'>diff
path: root/link.zsh (unfollow)
Commit message (Expand)Author
2018-02-12Only list first space of tabsJune McEnroe
2018-02-12Use Intel syntax in LLDBJune McEnroe
2018-02-11Add "Close Window" menu item to gfx/cocoaJune McEnroe
2018-02-11Tweak gfxx code styleJune McEnroe
2018-02-11Avoid xres/yres names in gfxxJune McEnroe
2018-02-11Only set GFX if unsetJune McEnroe
2018-02-09Link -lncursesJune McEnroe
2018-02-09Fix X11 KeySym lookup with modifiersJune McEnroe
2018-02-09Clean up bin/gfx/x11.cJune McEnroe
2018-02-09Move gfx interface to header fileJune McEnroe
2018-02-09Silence BSD ctags warningsJune McEnroe
2018-02-09Link LDLIBS regardless of GFXJune McEnroe
2018-02-09Move gfx frontends around to simplify buildJune McEnroe
2018-02-07Add janky X11 graphics frontendJune McEnroe
2018-02-07Include stdio.h in gfb.cJune McEnroe
2018-02-07Exit by returning false from input to gf{b,cocoa}June McEnroe
2018-02-07Rename title to status in gfcocoaJune McEnroe
2018-02-06Require 4 bit counts on gfxx command lineJune McEnroe
2018-02-06Add gfxx controls for custom bitsJune McEnroe
2018-02-06Add gfxx palette loading and dumpingJune McEnroe
2018-02-06Add tags targetJune McEnroe
2018-02-06Replace gfxx SCALE macro with interp functionJune McEnroe
2018-02-05Rename gfxx space indexed and add palette samplingJune McEnroe
2018-02-05Take scale into account for when to stop drawing in gfxxJune McEnroe
2018-02-05Always skip most significant bits in gfxxJune McEnroe
2018-02-05Set title in gfcocoaJune McEnroe
2018-02-05Double-buffer gfb frontendJune McEnroe
2018-02-05Rewrite gfxx bit handlingJune McEnroe
2018-02-05Add flip option to gfxxJune McEnroe
2018-02-05Remove gfxx reverse optionJune McEnroe
2018-02-04Fix gfxx draw stop conditionJune McEnroe
2018-02-04Reuse CGColorSpace and CGDataProvider in gfcocoaJune McEnroe
2018-02-04Mark mac target phonyJune McEnroe
2018-02-04Set up Makefile for gfxx-cocoa or gfxx-fbJune McEnroe
2018-02-04Avoid doing excessive work in gfxxJune McEnroe
2018-02-04Handle window resizing in gfcocoaJune McEnroe
2018-02-04Set cinoptionsJune McEnroe
2018-02-04Tweak colorscheme moreJune McEnroe
2018-02-04Color MatchParen DarkYellowJune McEnroe
2018-02-04Add palette sampling to gfxxJune McEnroe
2018-02-04Add 4-bit RGB to gfxxJune McEnroe
2018-02-04Add Quit menu item to gfcocoaJune McEnroe
2018-02-04Switch back to sane Objective-C styleJune McEnroe
2018-02-04Quit gfcocoa when window closesJune McEnroe
2018-02-03Apparently this is how people write Objective-CJune McEnroe