From d8cd384622fe8b00c7c257814cfcfec59d1e928e Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Wed, 6 Nov 2019 17:18:05 -0500 Subject: Use #defines for constant strings GCC hates declaring static consts in headers and not using them, for some stupid reason. --- bounce.h | 6 +++--- client.c | 12 ++++++------ state.c | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/bounce.h b/bounce.h index 37cfc7c..08313d5 100644 --- a/bounce.h +++ b/bounce.h @@ -27,13 +27,13 @@ #define CERTBOT_PATH "/usr/local/etc/letsencrypt" #endif +#define SOURCE_URL "https://code.causal.agency/june/pounce" +#define ORIGIN "irc.invalid" + #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0])) typedef unsigned char byte; -static const char *SourceURL = "https://code.causal.agency/june/pounce"; -static const char *Origin = "irc.invalid"; - bool verbose; enum { ParamCap = 15 }; diff --git a/client.c b/client.c index 8e4ed8e..3e8b15b 100644 --- a/client.c +++ b/client.c @@ -93,7 +93,7 @@ static void passRequired(struct Client *client) { client, ":%s 464 * :Password incorrect\r\n" "ERROR :Password incorrect\r\n", - Origin + ORIGIN ); client->error = true; } @@ -150,25 +150,25 @@ static void handleCap(struct Client *client, struct Message *msg) { } else if (!strcmp(msg->params[0], "LS")) { if (client->need) client->need |= NeedCapEnd; - clientFormat(client, ":%s CAP * LS :server-time\r\n", Origin); + clientFormat(client, ":%s CAP * LS :server-time\r\n", ORIGIN); } else if (!strcmp(msg->params[0], "REQ") && msg->params[1]) { if (client->need) client->need |= NeedCapEnd; if (!strcmp(msg->params[1], "server-time")) { client->serverTime = true; - clientFormat(client, ":%s CAP * ACK :server-time\r\n", Origin); + clientFormat(client, ":%s CAP * ACK :server-time\r\n", ORIGIN); } else { - clientFormat(client, ":%s CAP * NAK :%s\r\n", Origin, msg->params[1]); + clientFormat(client, ":%s CAP * NAK :%s\r\n", ORIGIN, msg->params[1]); } } else if (!strcmp(msg->params[0], "LIST")) { clientFormat( client, ":%s CAP * LIST :%s\r\n", - Origin, (client->serverTime ? "server-time" : "") + ORIGIN, (client->serverTime ? "server-time" : "") ); } else { - clientFormat(client, ":%s 410 * :Invalid CAP subcommand\r\n", Origin); + clientFormat(client, ":%s 410 * :Invalid CAP subcommand\r\n", ORIGIN); } } diff --git a/state.c b/state.c index 6486dde..da5c96f 100644 --- a/state.c +++ b/state.c @@ -324,7 +324,7 @@ void stateSync(struct Client *client) { client, ":%s NOTICE %s :" "pounce is GPLv3 fwee softwawe ^w^ code is avaiwable fwom %s\r\n", - Origin, self.nick, SourceURL + ORIGIN, self.nick, SOURCE_URL ); clientFormat( @@ -373,7 +373,7 @@ void stateSync(struct Client *client) { if (chan->topic) { clientFormat( client, ":%s 332 %s %s :%s\r\n", - Origin, self.nick, chan->name, chan->topic + ORIGIN, self.nick, chan->name, chan->topic ); } if (stateJoinNames) serverFormat("NAMES %s\r\n", chan->name); -- cgit 1.4.1 020-12-02Fix missing "to" in "hot tips"June McEnroe 2020-12-02Publish "hot tips"June McEnroe 2020-11-26Publish "Inability"June McEnroe 2020-11-26Render content into atom feedJune McEnroe 2020-11-26Update plan with different things I won't doJune McEnroe 2020-11-19Add "Come On Petunia"June McEnroe 2020-11-13Add x4 to LESSJune McEnroe 2020-11-04Remove modified sensitivity settingsJune McEnroe 2020-10-29Remove editJune McEnroe 2020-10-27Switch gr alias back to git rebaseJune McEnroe 2020-10-27Allow cd host: to cd to same path over sshJune McEnroe 2020-10-27Use SendEnv for cd host:pathJune McEnroe 2020-10-27Allow cd host:path over sshJune McEnroe 2020-10-07Use mandoc -T utf8 for text.June McEnroe 2020-09-20Add The Awakened KingdomJune McEnroe 2020-09-12Move /opt/local back, cheat port select to use system manJune McEnroe 2020-09-12Move /opt/local behind /usr againJune McEnroe 2020-09-12Enable toc in cgit renderings of man pagesJune McEnroe 2020-09-11Install mandoc on macOSJune McEnroe 2020-09-11Rewrite install script yet againJune McEnroe 2020-09-11Remove NetBSD from install scriptJune McEnroe 2020-09-11Use MacPorts rather than pkgsrcJune McEnroe 2020-09-11Add debian VM name to sshJune McEnroe 2020-09-11Add influencer tweetJune McEnroe 2020-09-10Add The Kingdom of GodsJune McEnroe 2020-09-07Add SunglassesJune McEnroe 2020-09-06Add Between the BreathsJune McEnroe 2020-09-04Open /dev/tty in nudgeJune McEnroe 2020-09-04Add nudgeJune McEnroe 2020-09-03Build fbclock with -lzJune McEnroe 2020-08-29Add tweets from retweetsJune McEnroe