* (at your option) any later version.
* Please read the file COPYING, README and AUTHORS for more information.
*
- * functions to dynamically allocate arrays.
+ * libarray - dynamically allocate arrays.
* Copyright (c) 2005 Florian Westphal (westphal@foo.fh-furtwangen.de)
- *
*/
-#include "array.h"
+/**
+ * @file
+ * Functions to dynamically allocate arrays.
+ */
-static char UNUSED id[] = "$Id: array.c,v 1.15 2007/11/18 15:05:35 alex Exp $";
+#include "array.h"
#include <assert.h>
-
#include <stdlib.h>
#include <string.h>
/* Enable more Debug messages in alloc / append / memmove code. */
/* #define DEBUG_ARRAY */
+#define array_UNUSABLE(x) ( !(x)->mem )
-#define array_UNUSABLE(x) ( !(x)->mem || (0 == (x)->allocated) )
static bool
safemult_sizet(size_t a, size_t b, size_t *res)
{
if (array_UNUSABLE(a))
return 0;
+ assert(a->allocated);
return membersize ? a->used / membersize : 0;
}
if (array_UNUSABLE(src))
return false;
+ assert(src->allocated);
return array_copyb(dest, src->mem, src->used);
}