diff options
| author | Florian Westphal <fw@strlen.de> | 2011-01-09 19:40:54 +0100 |
|---|---|---|
| committer | Florian Westphal <fw@strlen.de> | 2011-01-09 19:40:54 +0100 |
| commit | 23ce0393b23779f19d6d56103c46f9d929fdef53 (patch) | |
| tree | 20b85b31803e5b25dc8130b35a8f4286d15c1166 | |
| parent | 994a003aba9aac4a8adca7f4f4fec0889b0f2bb1 (diff) | |
| download | ngircd-23ce0393b23779f19d6d56103c46f9d929fdef53.tar.gz ngircd-23ce0393b23779f19d6d56103c46f9d929fdef53.zip | |
array: remove check for allocated == 0
allocated can only be zero if ->mem is NULL.
| -rw-r--r-- | src/ngircd/array.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ngircd/array.c b/src/ngircd/array.c index 75106f62..0fa96085 100644 --- a/src/ngircd/array.c +++ b/src/ngircd/array.c @@ -12,8 +12,6 @@ #include "array.h" -static char UNUSED id[] = "$Id: array.c,v 1.15 2007/11/18 15:05:35 alex Exp $"; - #include <assert.h> #include <stdlib.h> @@ -26,7 +24,7 @@ static char UNUSED id[] = "$Id: array.c,v 1.15 2007/11/18 15:05:35 alex Exp $"; -#define array_UNUSABLE(x) ( !(x)->mem || (0 == (x)->allocated) ) +#define array_UNUSABLE(x) ( !(x)->mem ) static bool safemult_sizet(size_t a, size_t b, size_t *res) { @@ -93,6 +91,7 @@ array_length(const array * const a, size_t membersize) if (array_UNUSABLE(a)) return 0; + assert(a->allocated); return membersize ? a->used / membersize : 0; } @@ -104,6 +103,7 @@ array_copy(array * dest, const array * const src) if (array_UNUSABLE(src)) return false; + assert(src->allocated); return array_copyb(dest, src->mem, src->used); } |