remove some redundant checks - geomyidae - A small C-based gopherd.
git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/
Log
Files
Refs
Tags
README
LICENSE
---
commit 3717798485ae28c453c83a109d17e66188d8379d
parent 42ed4146e6040a362e67369d862daabff0a01f4b
Author: Hiltjo Posthuma 
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(-)
---
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;
         }
 }
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);