]> PatchyGit - patchyircd.git/commitdiff
s/strdup/mystrdup
authorEgor <egor@patchysicp.xyz>
Tue, 3 May 2022 18:58:35 +0000 (21:58 +0300)
committerEgor <egor@patchysicp.xyz>
Tue, 3 May 2022 18:58:35 +0000 (21:58 +0300)
irc.c
util.h

diff --git a/irc.c b/irc.c
index 9501222..896869e 100644 (file)
--- a/irc.c
+++ b/irc.c
@@ -105,10 +105,10 @@ int processPacket(struct client_data *client) {
                strcpy(client->username + 1, args[0]);
                // set realname
                free(client->realname); // ditto
-               client->realname = strdup(args[3]);
+               client->realname = mystrdup(args[3]);
                if (!client->realname)
                        abort();
-               client->hostname = strdup(hostname);
+               client->hostname = mystrdup(hostname);
                if (!client->hostname)
                        abort();
                // Send welcome
@@ -381,7 +381,7 @@ int processPacket(struct client_data *client) {
                        return 0;
                if (args[0]) {
                        free(client->away);
-                       client->away = strdup(args[0]);
+                       client->away = mystrdup(args[0]);
                        if (!client->away) abort();
                        copy_strf(&databuf, ":%s 306 %s :You have been marked as being away\n", hostname, client->nick);
                        send_log(client->FD, databuf.buf, databuf.len, 0);
diff --git a/util.h b/util.h
index 340ee17..f3985f0 100644 (file)
--- a/util.h
+++ b/util.h
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include <string.h>
 
 struct dynarr {
        char *buf;
@@ -11,4 +12,7 @@ void append_strf(struct dynarr *d, const char *s, ...);
 #define copy_strf(d, ...) append_strf(((d)->len=0, (d)), __VA_ARGS__)
 void stringupper(char *s);
 void stringlower(char *s);
+#ifndef _MSC_VER
+#pragma GCC poison strdup
+#endif
 char *mystrdup(const char *s);