commit - a2f5a05ff86402bb7fb09094c52d607743fc9f49
commit + 4c6c6ecf0edcda29329f440eaa8dbb669b16c58a
blob - 6e96bd56b0d5635324e8c04f71f41f4b4b94d66a
blob + bc28d042fdd4e65d8aba29b5e1760a2f31137bbc
--- src/ngircd/array.c
+++ src/ngircd/array.c
#include "array.h"
-static char UNUSED id[] = "$Id: array.c,v 1.11 2006/07/01 22:11:48 fw Exp $";
+static char UNUSED id[] = "$Id: array.c,v 1.12 2006/09/30 21:49:46 fw Exp $";
#include <assert.h>
assert(size > 0);
- if (pos_plus1 < pos)
- return NULL;
-
- if (!safemult_sizet(size, pos_plus1, &alloc))
+ if (pos_plus1 == 0 || !safemult_sizet(size, pos_plus1, &alloc))
return NULL;
if (a->allocated < alloc) {
if (a->allocated < totalsize)
return NULL;
- return a->mem + pos * membersize;
+ return a->mem + totalsize;
}
a->mem = NULL;
a->allocated = 0;
a->used = 0;
-}
-
-
-void
-array_free_wipe(array * a)
-{
- if (!array_UNUSABLE(a))
- memset(a->mem, 0, a->allocated);
-
- array_free(a);
}
assert(a != NULL);
assert(membersize > 0);
- if (!pos)
- return;
-
if (!safemult_sizet(membersize, pos, &bytepos)) {
a->used = 0;
return;