From 155b59f60102050ad80e1e2056b4033a350c0cbf Mon Sep 17 00:00:00 2001 From: Egor Date: Tue, 3 May 2022 21:58:35 +0300 Subject: [PATCH] s/strdup/mystrdup --- irc.c | 6 +++--- util.h | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/irc.c b/irc.c index 9501222..896869e 100644 --- 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 --- a/util.h +++ b/util.h @@ -1,4 +1,5 @@ #include +#include 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); -- 2.56.0