Fix error in MyCalloc definition; memdebug compile fixes.
authorMichael Poole <mdpoole@troilus.org>
Thu, 27 Jan 2005 04:07:46 +0000 (04:07 +0000)
committerMichael Poole <mdpoole@troilus.org>
Thu, 27 Jan 2005 04:07:46 +0000 (04:07 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1306 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/ircd_alloc.h
include/memdebug.h
ircd/Makefile.in
ircd/ircd_alloc.c
ircd/memdebug.c
ircd/umkpasswd.c

index 7e6b073865eff4ba0b4f2619b2c77c3ad8e01f85..1eee3969d321d6c3500002867c32b4c82db91d12 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+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.
index a2aa32fb195c846e81aa43ced3a0c1936ec56426..237daa4681976885c37874c3a4081061ca0edc33 100644 (file)
@@ -39,7 +39,7 @@ extern void set_nomem_handler(OutOfMemoryHandler handler);
 
 /** 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) \
@@ -73,7 +73,7 @@ extern void *DoRealloc(void *, size_t, const char*, int);
 #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) */
index bff560326911f613b00fadd1e65fb256dca197b5..1c92d9531ce6d6278dec2ebd9a114b5c6e507b95 100644 (file)
@@ -4,3 +4,5 @@ void *dbg_malloc(size_t size, const char *type, const char *file, int line);
 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);
index 3a1dfd28aa1e5f4c0f0a5c590b54f989da4d92d5..8914e4b319f919e3df3174f787b46d8eedb2a07b 100644 (file)
@@ -79,6 +79,7 @@ CRYPTO_SRC = \
 UMKPASSWD_SRC = ${CRYPTO_SRC} \
        ircd_alloc.c \
        ircd_string.c \
+       memdebug.c \
        umkpasswd.c
 
 IRCD_SRC = \
index 5dd4ef7fccd183f91e4594a223ea1d703643b843..1fc87fa8769219b84d942d9b389a5cc6dbd7f6eb 100644 (file)
@@ -57,6 +57,7 @@ set_nomem_handler(OutOfMemoryHandler handler)
   noMemHandler = handler;
 }
 
+#ifndef MDEBUG
 /** Allocate memory.
  * @param[in] size Number of bytes to allocate.
  * @param[in] x Type of allocation (ignored).
@@ -101,3 +102,4 @@ void* DoRealloc(void *orig, size_t size, const char *file, int line)
     (*noMemHandler)();
   return t;
 }
+#endif
index 8e998209e0494d17e7e3db87bc2b7304e7e5785d..af7e53011c9da53eaf8529d7fc9db160371846d9 100644 (file)
@@ -4,7 +4,9 @@
 #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 */
 
index aa2f7f63f49d0798092d7ac5c3df9babee4d7bcd..a259542d6b155af6c62d10c74ffbeff341542b89 100644 (file)
 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)
 {