+2005-01-26 Michael Poole <mdpoole@troilus.org>
+
+ * include/ircd_alloc.h (DoMallocZero): Parenthesize macro
+ arguments, fixing operator precedence problems.
+ (DoFree): Make debug version also overwrite p.
+
+ * include/memdebug.h (fda_get_byte_count, fda_get_block_count):
+ Declare functions used outside memdebug.c.
+
+ * ircd/Makefile.c (UMKPASSWD_SRC): Add memdebug.c.
+
+ * ircd/ircd_alloc.c (DoMalloc, DoMallocZero, DoRealloc): Do not
+ use these if using the memdebug version.
+
+ * ircd/memdebug.c: #include "send.h" and <string.h> to get
+ declarations for certain functions.
+
+ * ircd/umkpasswd.c (CurrentTime): Define in case of memdebug.
+ (sendto_opmask_butone): Likewise.
+
2005-01-25 Michael Poole <mdpoole@troilus.org>
* configure.in: Fix typos and thinkos in previous commut.
/** Helper macro for zero-initialized allocations. */
#define MyCalloc(nelem, size) \
- DoMallocZero(size * nelem, "calloc", __FILE__, __LINE__)
+ DoMallocZero((size) * (nelem), "calloc", __FILE__, __LINE__)
/** Helper macro for freeing memory. */
#define MyFree(p) \
#define DoMallocZero(size, type, file, line) \
dbg_malloc_zero(size, type, file, line)
#define DoFree(p, file, line) \
- dbg_free(p, file, line)
+ do { dbg_free(p, file, line); (p) = 0; } while (0)
#define DoRealloc(p, size, file, line) \
dbg_realloc(p, size, file, line)
#endif /* defined(MDEBUG) */
void *dbg_malloc_zero(size_t size, const char *type, const char *file, int line);
void *dbg_realloc(void *ptr, size_t size, const char *file, int line);
void dbg_free(void *ptr, const char *file, int line);
+size_t fda_get_byte_count(void);
+size_t fda_get_block_count(void);
UMKPASSWD_SRC = ${CRYPTO_SRC} \
ircd_alloc.c \
ircd_string.c \
+ memdebug.c \
umkpasswd.c
IRCD_SRC = \
noMemHandler = handler;
}
+#ifndef MDEBUG
/** Allocate memory.
* @param[in] size Number of bytes to allocate.
* @param[in] x Type of allocation (ignored).
(*noMemHandler)();
return t;
}
+#endif
#include "ircd_log.h"
#include "client.h"
#include "s_debug.h"
+#include "send.h"
#include <stdlib.h>
+#include <string.h>
/* #include <assert.h> -- Now using assert in ircd_log.h */
umkpasswd_conf_t* umkpasswd_conf;
crypt_mechs_t* crypt_mechs_root;
int log_inassert = 0;
+time_t CurrentTime;
+
+void sendto_opmask_butone(struct Client *one, unsigned int mask,
+ const char *pattern, ...)
+{
+ /* only needed with memdebug, which also calls Debug() */
+}
void copyright(void)
{