diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2015-04-02 20:58:44 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2015-04-02 20:58:44 +0000 |
commit | 92ef4bfddd0b4402c4d13de2713e9ab49d56bfa3 (patch) | |
tree | b17950e2e9bc817597f78fc069290b3f580071a0 /usr.bin/sort | |
parent | 770677ed85fe7cf50a5fd4f7e53ff36a87a403ae (diff) |
Zap some more NULL checks in front of free.
ok millert@
Diffstat (limited to 'usr.bin/sort')
-rw-r--r-- | usr.bin/sort/coll.c | 4 | ||||
-rw-r--r-- | usr.bin/sort/radixsort.c | 14 |
2 files changed, 7 insertions, 11 deletions
diff --git a/usr.bin/sort/coll.c b/usr.bin/sort/coll.c index 2087817e8bf..3f6b68a1f79 100644 --- a/usr.bin/sort/coll.c +++ b/usr.bin/sort/coll.c @@ -1,4 +1,4 @@ -/* $OpenBSD: coll.c,v 1.6 2015/04/01 21:47:19 millert Exp $ */ +/* $OpenBSD: coll.c,v 1.7 2015/04/02 20:58:43 tobias Exp $ */ /*- * Copyright (C) 2009 Gabor Kovesdan <gabor@FreeBSD.org> @@ -120,7 +120,7 @@ set_key_on_keys_array(struct keys_array *ka, struct bwstring *s, size_t ind) kv = &(ka->key[ind]); - if (kv->k && kv->k != s) + if (kv->k != s) bwsfree(kv->k); kv->k = s; } diff --git a/usr.bin/sort/radixsort.c b/usr.bin/sort/radixsort.c index bc68e45a5cd..532b5c8b8c5 100644 --- a/usr.bin/sort/radixsort.c +++ b/usr.bin/sort/radixsort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radixsort.c,v 1.3 2015/04/01 20:58:13 millert Exp $ */ +/* $OpenBSD: radixsort.c,v 1.4 2015/04/02 20:58:43 tobias Exp $ */ /*- * Copyright (C) 2012 Oleg Moskalenko <mom040267@gmail.com> @@ -177,8 +177,7 @@ static void free_sort_level(struct sort_level *sl) { if (sl) { - if (sl->leaves) - sort_free(sl->leaves); + sort_free(sl->leaves); if (sl->level > 0) sort_free(sl->tosort); @@ -191,8 +190,7 @@ free_sort_level(struct sort_level *sl) for (i = 0; i < sln; ++i) { slc = sl->sublevels[i]; - if (slc) - free_sort_level(slc); + free_sort_level(slc); } sort_free(sl->sublevels); @@ -208,10 +206,8 @@ run_sort_level_next(struct sort_level *sl) struct sort_level *slc; size_t i, sln, tosort_num; - if (sl->sublevels) { - sort_free(sl->sublevels); - sl->sublevels = NULL; - } + sort_free(sl->sublevels); + sl->sublevels = NULL; switch (sl->tosort_num){ case 0: |