aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-04-07 06:26:23 -0400
committerB. Watson <urchlay@slackware.uk>2026-04-07 06:26:31 -0400
commit53ce04126721711875031fd64b8ab1b7d05167ae (patch)
tree28e886ca54905915d1d7d3eec1d90c04d92935c8 /src
parent55220e41c17b8e9dd140f1c770d4885e317d160b (diff)
downloadfujinet-chat-53ce04126721711875031fd64b8ab1b7d05167ae.tar.gz
Rewrite txbuf_append_str2(), txbuf_set_str2(), txbuf_set_str3() as macros (actually saves code). 7159 bytes free.
Diffstat (limited to 'src')
-rw-r--r--src/irc.h10
-rw-r--r--src/main.c6
2 files changed, 13 insertions, 3 deletions
diff --git a/src/irc.h b/src/irc.h
index 7d8f735..c2fdb87 100644
--- a/src/irc.h
+++ b/src/irc.h
@@ -17,15 +17,19 @@ void txbuf_append_chr(char c);
/* appends a string to the transmit buffer, updates txbuflen. */
void txbuf_append_str(const char *str);
-void txbuf_append_str2(const char *s1, const char *s2);
+#define txbuf_append_str2(s1, s2) do { txbuf_append_str(s1); txbuf_append_str(s2); } while(0)
+// void txbuf_append_str2(const char *s1, const char *s2);
// void txbuf_append_str3(const char *s1, const char *s2, const char *s3);
/* clears the transmit buffer, then appends a string to it. */
+/* turning into a macro bloats the code */
void txbuf_set_str(const char *str);
/* as txbuf_set_str(), but multiple strings. */
-void txbuf_set_str2(const char *s1, const char *s2);
-void txbuf_set_str3(const char *s1, const char *s2, const char *s3);
+#define txbuf_set_str2(s1, s2) do { txbuf_set_str(s1); txbuf_append_str(s2); } while(0)
+// void txbuf_set_str2(const char *s1, const char *s2);
+#define txbuf_set_str3(s1, s2, s3) do { txbuf_set_str(s1); txbuf_append_str(s2); txbuf_append_str(s3); } while(0)
+// void txbuf_set_str3(const char *s1, const char *s2, const char *s3);
/* sends whatever's in the transmit buffer, then clears it. if nothing was
in the buffer, nothing gets sent. */
diff --git a/src/main.c b/src/main.c
index 1f533b3..9effe26 100644
--- a/src/main.c
+++ b/src/main.c
@@ -33,10 +33,12 @@ void txbuf_init(void) {
txbuflen = tx_buf[0] = 0;
}
+/*
void txbuf_append_str2(const char *s1, const char *s2) {
txbuf_append_str(s1);
txbuf_append_str(s2);
}
+*/
/*
void txbuf_append_str3(const char *s1, const char *s2, const char *s3) {
@@ -51,15 +53,19 @@ void txbuf_set_str(const char *str) {
txbuf_append_str(str);
}
+/*
void txbuf_set_str2(const char *s1, const char *s2) {
txbuf_set_str(s1);
txbuf_append_str(s2);
}
+*/
+/*
void txbuf_set_str3(const char *s1, const char *s2, const char *s3) {
txbuf_set_str2(s1, s2);
txbuf_append_str(s3);
}
+*/
void txbuf_send(void) {
/* don't send empty buffer */