remove some redundant checks - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 3717798485ae28c453c83a109d17e66188d8379d DIR parent 42ed4146e6040a362e67369d862daabff0a01f4b HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org> Date: Fri, 16 Jun 2017 18:21:46 +0200 remove some redundant checks - freeelem checks for nil. - free(nil) is valid too. Signed-off-by: Christoph Lohmann <20h@r-36.net> Diffstat: M handlr.c | 6 ++---- M ind.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) --- DIR diff --git a/handlr.c b/handlr.c @@ -172,8 +172,7 @@ handlecgi(int sock, char *file, char *port, char *base, char *args, break; default: wait(NULL); - if (path != nil) - free(path); + free(path); break; } } @@ -238,8 +237,7 @@ handledcgi(int sock, char *file, char *port, char *base, char *args, dprintf(sock, ".\r\n"); wait(NULL); - if (path != nil) - free(path); + free(path); break; } } DIR diff --git a/ind.c b/ind.c @@ -149,8 +149,7 @@ freeindex(Indexs *i) if(i != nil) { if(i->n != nil) { for(;i->num > 0; i->num--) - if(i->n[i->num - 1] != nil) - freeelem(i->n[i->num - 1]); + freeelem(i->n[i->num - 1]); free(i->n); } free(i);