X-Git-Url: https://git.armaanb.net/?p=sic.git;a=blobdiff_plain;f=util.c;h=8cea8836cf6dc14dbadb5394201b45cda9dc0d34;hp=c2982fde6e8d9ed37062c63780281b8ad47af645;hb=HEAD;hpb=b188c784329baf8479f30f06c61c12226d797115 diff --git a/util.c b/util.c index c2982fd..8cea883 100644 --- a/util.c +++ b/util.c @@ -18,9 +18,9 @@ eprint(const char *fmt, ...) { static int dial(char *host, char *port) { - static struct addrinfo hints; - int fd; + struct addrinfo hints; struct addrinfo *res, *r; + int fd; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; @@ -60,8 +60,7 @@ static void trim(char *s) { char *e; - e = s + strlen(s) - 1; - while(e > s && isspace((unsigned char)*e)) - e--; - *(e + 1) = '\0'; + for (e = s + strlen(s); e > s && isspace((unsigned char)*(e - 1)); e--) + ; + *e = '\0'; }