| Unify the style of variable initialisation. - geomyidae - A small C-based gophe… | |
| git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfri… | |
| Log | |
| Files | |
| Refs | |
| Tags | |
| README | |
| LICENSE | |
| --- | |
| commit 4500d3596d7b166ad1e832adeefc6be3da685b09 | |
| parent 134b64204e21b6c2572b7f933a7d961abdd904f0 | |
| Author: Christoph Lohmann <[email protected]> | |
| Date: Sun, 7 Jun 2020 13:10:14 +0200 | |
| Unify the style of variable initialisation. | |
| Diffstat: | |
| M ind.c | 5 +---- | |
| M main.c | 30 +++++++++--------------------- | |
| 2 files changed, 10 insertions(+), 25 deletions(-) | |
| --- | |
| diff --git a/ind.c b/ind.c | |
| @@ -85,10 +85,7 @@ pendingbytes(int sock) | |
| void | |
| waitforpendingbytes(int sock) | |
| { | |
| - int npending, opending, trytime; | |
| - | |
| - npending = opending = 0; | |
| - trytime = 10; | |
| + int npending = 0, opending = 0, trytime = 10; | |
| /* | |
| * Wait until there is nothing pending or the connection stalled | |
| diff --git a/main.c b/main.c | |
| @@ -120,16 +120,14 @@ handlerequest(int sock, char *base, char *ohost, char *po… | |
| char *clientp, int nocgi) | |
| { | |
| struct stat dir; | |
| - char recvc[1025], recvb[1025], path[1025], *args, *sear, *c; | |
| - int len, fd, i, retl, maxrecv; | |
| + char recvc[1025], recvb[1025], path[1025], *args = NULL, *sear, *c; | |
| + int len = 0, fd, i, retl, maxrecv; | |
| filetype *type; | |
| memset(&dir, 0, sizeof(dir)); | |
| memset(recvb, 0, sizeof(recvb)); | |
| memset(recvc, 0, sizeof(recvc)); | |
| - args = NULL; | |
| - len = 0; | |
| maxrecv = sizeof(recvb); | |
| /* | |
| * Force at least one byte per packet. Limit, so the server | |
| @@ -423,28 +421,18 @@ main(int argc, char *argv[]) | |
| struct addrinfo hints; | |
| struct sockaddr_storage clt; | |
| socklen_t cltlen; | |
| - int sock, dofork, inetf, usechroot, nocgi, errno_save, nbindips, i, j, | |
| + int sock, dofork = 1, inetf = AF_UNSPEC, usechroot = 0, | |
| + nocgi = 0, errno_save, nbindips = 0, i, j, | |
| nlfdret, *lfdret, listfd, maxlfd; | |
| - char *port, *base, clienth[NI_MAXHOST], clientp[NI_MAXSERV]; | |
| - char *user, *group, **bindips, *ohost, *sport, *p; | |
| - struct passwd *us; | |
| - struct group *gr; | |
| fd_set rfd; | |
| + char *port, *base, clienth[NI_MAXHOST], clientp[NI_MAXSERV], | |
| + *user = NULL, *group = NULL, **bindips = NULL, | |
| + *ohost = NULL, *sport = NULL, *p; | |
| + struct passwd *us = NULL; | |
| + struct group *gr = NULL; | |
| base = stdbase; | |
| port = stdport; | |
| - dofork = 1; | |
| - user = NULL; | |
| - group = NULL; | |
| - us = NULL; | |
| - gr = NULL; | |
| - bindips = NULL; | |
| - nbindips = 0; | |
| - ohost = NULL; | |
| - sport = NULL; | |
| - inetf = AF_UNSPEC; | |
| - usechroot = 0; | |
| - nocgi = 0; | |
| ARGBEGIN { | |
| case '4': |