commit - c7693f625e9d6c5a7c8aea7a8c8bb5c5a5378843
commit + 76604f847aef63fbf091c03b0b938cf9a89c94d9
blob - e468a1e5e871329c0796137a4981914b37cd5557
blob + 26c636a6394870d7d2aa941dbd7e46773c981cdb
--- src/ngircd/array.c
+++ src/ngircd/array.c
#include "array.h"
-static char UNUSED id[] = "$Id: array.c,v 1.2 2005/07/07 21:26:31 fw Exp $";
+static char UNUSED id[] = "$Id: array.c,v 1.3 2005/07/11 14:10:53 fw Exp $";
#include <assert.h>
unsigned int aligned = 0;
char *tmp;
- assert(size);
+ assert(size > 0);
if (pos_plus1 < pos)
return NULL;
unsigned int
array_length(const array * const a, unsigned int membersize)
{
- assert(a);
- assert(membersize);
+ assert(a != NULL);
+ assert(membersize > 0);
if (array_UNUSABLE(a))
return 0;
bool
array_copyb(array * dest, const char *src, unsigned int len)
{
- assert(dest);
- assert(src);
+ assert(dest != NULL);
+ assert(src != NULL );
if (!len || !src)
return true;
unsigned int used;
char *ptr;
- assert(dest);
- assert(src);
+ assert(dest != NULL);
+ assert(src != NULL);
if (!len)
return true;
ptr = dest->mem;
- assert(ptr);
+ assert(ptr != NULL);
#ifdef DEBUG
Log(LOG_DEBUG,
{
unsigned int totalsize;
- assert(membersize);
- assert(a);
+ assert(membersize > 0);
+ assert(a != NULL);
if (array_UNUSABLE(a))
return NULL;
void
array_free(array * a)
{
- assert(a);
+ assert(a != NULL);
#ifdef DEBUG
Log(LOG_DEBUG,
"array_free: %u bytes free'd (%u bytes still used at time of free())",
void *
array_start(const array * const a)
{
- assert(a);
+ assert(a != NULL);
return a->mem;
}
void
array_trunc(array * a)
{
- assert(a);
+ assert(a != NULL);
a->used = 0;
}
array_truncate(array * a, unsigned int membersize, unsigned int len)
{
unsigned int newlen;
- assert(a);
+ assert(a != NULL);
if (!safemult_uint(membersize, len, &newlen))
return;
{
unsigned int bytepos;
- assert(a);
- assert(membersize);
+ assert(a != NULL);
+ assert(membersize > 0);
if (!pos)
return;