X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Farray.c;h=4cc793f18c02b3f4bea6dd1f46ed2914441740a5;hp=af66edd9305580aea5b53471a00a1300bfe0aaac;hb=HEAD;hpb=b130b35f48d19450240748425e12d21f2c38350f diff --git a/src/ngircd/array.c b/src/ngircd/array.c index af66edd9..6d1ab338 100644 --- a/src/ngircd/array.c +++ b/src/ngircd/array.c @@ -14,6 +14,9 @@ * Functions to dynamically allocate arrays. */ +/* Additionan debug messages related to array handling: 0=off / 1=on */ +#define DEBUG_ARRAY 0 + #include "array.h" #include @@ -21,13 +24,10 @@ #include #include -#ifdef DEBUG_ARRAY +#if DEBUG_ARRAY # include "log.h" #endif -/* Enable more Debug messages in alloc / append / memmove code. */ -/* #define DEBUG_ARRAY */ - #define array_UNUSABLE(x) ( !(x)->mem ) @@ -67,8 +67,8 @@ array_alloc(array * a, size_t size, size_t pos) return NULL; if (a->allocated < alloc) { -#ifdef DEBUG_ARRAY - Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.", +#if DEBUG_ARRAY + LogDebug("array_alloc(): changing size from %u to %u bytes.", a->allocated, alloc); #endif tmp = realloc(a->mem, alloc); @@ -168,8 +168,8 @@ array_catb(array * dest, const char *src, size_t len) assert(ptr != NULL); -#ifdef DEBUG_ARRAY - Log(LOG_DEBUG, +#if DEBUG_ARRAY + LogDebug( "array_catb(): appending %u bytes to array (now %u bytes in array).", len, tmp); #endif @@ -248,8 +248,8 @@ void array_free(array * a) { assert(a != NULL); -#ifdef DEBUG_ARRAY - Log(LOG_DEBUG, +#if DEBUG_ARRAY + LogDebug( "array_free(): %u bytes free'd (%u bytes still used at time of free()).", a->allocated, a->used); #endif @@ -314,8 +314,8 @@ array_moveleft(array * a, size_t membersize, size_t pos) if (!bytepos) return; /* nothing to do */ -#ifdef DEBUG_ARRAY - Log(LOG_DEBUG, +#if DEBUG_ARRAY + LogDebug( "array_moveleft(): %u bytes used in array, starting at position %u.", a->used, bytepos); #endif