]> PatchyGit - patchyircd.git/commitdiff
remove allocClient
authorEgor <egor@patchysicp.xyz>
Fri, 13 Jun 2025 01:38:21 +0000 (04:38 +0300)
committerEgor <egor@patchysicp.xyz>
Fri, 13 Jun 2025 01:38:21 +0000 (04:38 +0300)
src/main.cpp
src/net.cpp
src/net.h

index 49cb835..d579c05 100644 (file)
@@ -141,7 +141,7 @@ static void accept_from_sock(struct listener *listener)
 #endif
                }
                // Add to list of sockets
-               struct client_data *cl = allocClient();
+               client_data *cl = new client_data();
                cl->fd = fd;
                cl->cctx = cctx;
                cl->type = addr.ss_family == AF_INET6 ? 6 : 4;
@@ -291,7 +291,7 @@ int main(int argc, char *argv[])
 
        FILE *f = fopen(getdatafile("init.txt"), "rbe");
        if (f) {
-               struct client_data *fake = allocClient();
+               client_data *fake = new client_data();
                fake->fd = -1;
                fake->umode |= UMODE_OPER | UMODE_SECURE;
                fake->hostname = mystrdup("localhost");
index 4bd3862..02fd14b 100644 (file)
@@ -6,12 +6,6 @@
 #include "irc.h"
 #include "ircfmt.h"
 #include "job.h"
-
-struct client_data *allocClient(void)
-{
-       return (struct client_data *)calloc(1, sizeof(struct client_data));
-}
-
 void update_poll_reg(struct client_data *cl)
 {
        if (cl->fd == -1)
@@ -152,7 +146,7 @@ void killConnectionPart2(struct client_data *cl)
        free(cl->saslusername);
        free(cl->webircpeername);
        free(cl->webirchostname);
-       free(cl);
+       delete cl;
 }
 
 void recvProc(struct client_data *cl) {
index 47330d1..a2c5adc 100644 (file)
--- a/src/net.h
+++ b/src/net.h
@@ -7,7 +7,6 @@
 
 void sendbuf(struct client_data *client);
 void sendbuf_visible(struct client_data *client);
-struct client_data *allocClient(void);
 void update_poll_reg(struct client_data *cl);
 void log_client(struct client_data *cl, const char *format, ...);
 void killConnection(struct client_data *client, int byChoice);