diff options
author | Guillem Jover <guillem@debian.org> | 2017-03-15 13:33:09 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2018-03-26 15:30:18 +0200 |
commit | 9f7e58acdf28043bce2dfaf24ba27bb878418658 (patch) | |
tree | f5aabf9b868cb158cf380af4ab065fc2cdcf402b /dpkg-split | |
parent | 9622251478262d26ab6e01aa865417370a533069 (diff) | |
download | dpkg-9f7e58acdf28043bce2dfaf24ba27bb878418658.tar.gz |
Use internerr() or BUG() instead of assert()
The problem with assert() is that it does not print the contents of
the variables. It also can be disabled on NDEBUG. But we always want
these consistency checks no matter what, and they are not performance
sensitive anyway.
Enable -Wno-nonnull-compare so that we can keep doing run-time non-NULL
checks in functions, instead of just compile-time checks.
Diffstat (limited to 'dpkg-split')
-rw-r--r-- | dpkg-split/join.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/dpkg-split/join.c b/dpkg-split/join.c index 0a61bc921..b5e14712e 100644 --- a/dpkg-split/join.c +++ b/dpkg-split/join.c @@ -21,7 +21,6 @@ #include <config.h> #include <compat.h> -#include <assert.h> #include <limits.h> #include <string.h> #include <fcntl.h> @@ -120,7 +119,9 @@ do_join(const char *const *argv) refi= NULL; for (pq= queue; pq; pq= pq->nextinqueue) if (!refi || pq->info.thispartn < refi->thispartn) refi= &pq->info; - assert(refi); + if (refi == NULL) + internerr("empty deb part queue"); + partlist= nfmalloc(sizeof(struct partinfo*)*refi->maxpartn); for (i = 0; i < refi->maxpartn; i++) partlist[i] = NULL; |