commit - b35f8916a5252182070d0e4502a540e81a3ced90
commit + f547981188a28844068e864dc1ed955ff173d216
blob - af66edd9305580aea5b53471a00a1300bfe0aaac
blob + 4cc793f18c02b3f4bea6dd1f46ed2914441740a5
--- src/ngircd/array.c
+++ src/ngircd/array.c
* Functions to dynamically allocate arrays.
*/
+/* Additionan debug messages related to array handling: 0=off / 1=on */
+#define DEBUG_ARRAY 0
+
#include "array.h"
#include <assert.h>
#include <string.h>
#include <unistd.h>
-#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 )
return NULL;
if (a->allocated < alloc) {
-#ifdef DEBUG_ARRAY
+#if DEBUG_ARRAY
Log(LOG_DEBUG, "array_alloc(): changing size from %u to %u bytes.",
a->allocated, alloc);
#endif
assert(ptr != NULL);
-#ifdef DEBUG_ARRAY
+#if DEBUG_ARRAY
Log(LOG_DEBUG,
"array_catb(): appending %u bytes to array (now %u bytes in array).",
len, tmp);
array_free(array * a)
{
assert(a != NULL);
-#ifdef DEBUG_ARRAY
+#if DEBUG_ARRAY
Log(LOG_DEBUG,
"array_free(): %u bytes free'd (%u bytes still used at time of free()).",
a->allocated, a->used);
if (!bytepos)
return; /* nothing to do */
-#ifdef DEBUG_ARRAY
+#if DEBUG_ARRAY
Log(LOG_DEBUG,
"array_moveleft(): %u bytes used in array, starting at position %u.",
a->used, bytepos);
blob - 5ebb2a04189035a3f814e74fdbeda0a5abffb9a0
blob + e21dd345777a35c599f308aee587c6dee377c4dd
--- src/ngircd/conn-zip.c
+++ src/ngircd/conn-zip.c
* Please read the file COPYING, README and AUTHORS for more information.
*/
+#define CONN_MODULE
+
#include "portab.h"
/**
* Connection compression using ZLIB
*/
-#define CONN_MODULE
+/* Additionan debug messages related to ZIP compression: 0=off / 1=on */
+#define DEBUG_ZIP 0
#ifdef ZLIB
-
-/* enable more zlib related debug messages: */
-/* #define DEBUG_ZLIB */
#include <assert.h>
#include <string.h>
out->next_out = zipbuf;
out->avail_out = (uInt)sizeof zipbuf;
-#ifdef DEBUG_ZIP
+#if DEBUG_ZIP
Log(LOG_DEBUG, "out->avail_in %d, out->avail_out %d",
out->avail_in, out->avail_out);
#endif
assert(out->avail_out <= WRITEBUFFER_SLINK_LEN);
zipbuf_used = WRITEBUFFER_SLINK_LEN - out->avail_out;
-#ifdef DEBUG_ZIP
+#if DEBUG_ZIP
Log(LOG_DEBUG, "zipbuf_used: %d", zipbuf_used);
#endif
if (!array_catb(&My_Connections[Idx].wbuf,
in->next_out = unzipbuf;
in->avail_out = (uInt)sizeof unzipbuf;
-#ifdef DEBUG_ZIP
+#if DEBUG_ZIP
Log(LOG_DEBUG, "in->avail_in %d, in->avail_out %d",
in->avail_in, in->avail_out);
#endif
assert(z_rdatalen >= in->avail_in);
in_len = z_rdatalen - in->avail_in;
unzipbuf_used = READBUFFER_LEN - in->avail_out;
-#ifdef DEBUG_ZIP
+#if DEBUG_ZIP
Log(LOG_DEBUG, "unzipbuf_used: %d - %d = %d", READBUFFER_LEN,
in->avail_out, unzipbuf_used);
#endif
blob - 4ed586206f42107b0e32132530631545fede4ea4
blob + 4dfe62fbdb85935030dc3112032baee6668ba9ff
--- src/ngircd/conn.c
+++ src/ngircd/conn.c
* Please read the file COPYING, README and AUTHORS for more information.
*/
-#undef DEBUG_BUFFER
-
#define CONN_MODULE
#include "portab.h"
* @file
* Connection management
*/
+
+/* Additionan debug messages related to buffer handling: 0=off / 1=on */
+#define DEBUG_BUFFER 0
#include <assert.h>
#ifdef PROTOTYPES
return true;
}
-#ifdef DEBUG_BUFFER
+#if DEBUG_BUFFER
LogDebug
("Handle_Write() called for connection %d, %ld bytes pending ...",
Idx, wdatalen);
return 0; /* error -> connection has been closed */
array_moveleft(&My_Connections[Idx].rbuf, 1, len);
-#ifdef DEBUG_BUFFER
- LogDebug("Connection %d: %d bytes left in read buffer.",
- Idx, array_bytes(&My_Connections[Idx].rbuf));
-#endif
#ifdef ZLIB
if ((!old_z) && (My_Connections[Idx].options & CONN_ZIP) &&
(array_bytes(&My_Connections[Idx].rbuf) > 0)) {
}
#endif
}
+#if DEBUG_BUFFER
+ LogDebug("Connection %d: Processed %ld commands (max=%ld), %ld bytes. %ld bytes left in read buffer.",
+ Idx, i, maxcmd, len_processed,
+ array_bytes(&My_Connections[Idx].rbuf));
+#endif
+
return len_processed;
} /* Handle_Buffer */
blob - 779e7492ab010e8b9d81d3aa81f5b6b2a53e5c11
blob + 037c4afca2af7c0cf9662058ee2a18d3a92b12eb
--- src/ngircd/io.c
+++ src/ngircd/io.c
* I/O abstraction interface.
*/
+/* Extra debug messages in event add/delete/callback code: 0=off / 1=on */
+#define DEBUG_IO 0
+
#include <assert.h>
#include <string.h>
#include <sys/types.h>
#include "array.h"
#include "io.h"
#include "log.h"
-
-/* Enables extra debug messages in event add/delete/callback code. */
-/* #define DEBUG_IO */
typedef struct {
#ifdef PROTOTYPES
static void io_docallback PARAMS((int fd, short what));
-#ifdef DEBUG_IO
+#if DEBUG_IO
static void
io_debug(const char *s, int fd, int what)
{