From 7cd99ebc84e5ef4f96bd0d004e0cf511e0e5365f Mon Sep 17 00:00:00 2001 From: Markus Uhlin Date: Wed, 13 Dec 2023 20:06:01 +0100 Subject: Reformatted remConnection() --- FICS/network.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'FICS/network.c') diff --git a/FICS/network.c b/FICS/network.c index 65e34f6..78d2599 100644 --- a/FICS/network.c +++ b/FICS/network.c @@ -91,26 +91,32 @@ PUBLIC int net_addConnection(int fd, unsigned int fromHost) return 0; } -PRIVATE int remConnection(int fd) +PRIVATE int +remConnection(int fd) { - int which; - if ((which = findConnection(fd)) < 0) { - return -1; - } - numConnections--; - con[fd].status = NETSTAT_EMPTY; - if (con[fd].sndbuf == NULL) { - fprintf(stderr, "FICS: remcon(%d) SNAFU, this shouldn't happen.\n", fd); - } else { - if (con[fd].sndbufsize > MAX_STRING_LENGTH) { - con[fd].sndbufsize = MAX_STRING_LENGTH; - con[fd].sndbuf = rrealloc(con[fd].sndbuf, MAX_STRING_LENGTH); - } - if (con[fd].sndbufpos) { /* didn't send everything, bummer */ - con[fd].sndbufpos = 0; - } - } - return 0; + int which; + + if ((which = findConnection(fd)) < 0) + return -1; + numConnections--; + + con[fd].status = NETSTAT_EMPTY; + + if (con[fd].sndbuf == NULL) { + fprintf(stderr, "FICS: remcon(%d) SNAFU, " + "this shouldn't happen.\n", fd); + } else { + if (con[fd].sndbufsize > MAX_STRING_LENGTH) { + con[fd].sndbufsize = MAX_STRING_LENGTH; + con[fd].sndbuf = rrealloc(con[fd].sndbuf, + MAX_STRING_LENGTH); + } + + if (con[fd].sndbufpos) // didn't send everything, bummer + con[fd].sndbufpos = 0; + } + + return 0; } PRIVATE void -- cgit v1.2.3