Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-01-27 04:07:56 UTC

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

Log message:

Fix error in MyCalloc definition; memdebug compile fixes.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.542 ircu2.10/ChangeLog:1.543
--- ircu2.10/ChangeLog:1.542    Tue Jan 25 08:41:54 2005
+++ ircu2.10/ChangeLog  Wed Jan 26 20:07:43 2005
@@ -1,3 +1,23 @@
+2005-01-26  Michael Poole <[EMAIL PROTECTED]>
+
+       * 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 <[EMAIL PROTECTED]>
 
        * configure.in: Fix typos and thinkos in previous commut.
Index: ircu2.10/include/ircd_alloc.h
diff -u ircu2.10/include/ircd_alloc.h:1.7 ircu2.10/include/ircd_alloc.h:1.8
--- ircu2.10/include/ircd_alloc.h:1.7   Mon Oct  4 18:54:30 2004
+++ ircu2.10/include/ircd_alloc.h       Wed Jan 26 20:07:44 2005
@@ -20,7 +20,7 @@
  */
 /** @file
  * @brief IRC daemon memory allocation functions.
- * @version $Id: ircd_alloc.h,v 1.7 2004/10/05 01:54:30 entrope Exp $
+ * @version $Id: ircd_alloc.h,v 1.8 2005/01/27 04:07:44 entrope Exp $
  */
 #ifndef INCLUDED_ircd_alloc_h
 #define INCLUDED_ircd_alloc_h
@@ -39,7 +39,7 @@
 
 /** 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 @@
 #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: ircu2.10/include/memdebug.h
diff -u ircu2.10/include/memdebug.h:1.2 ircu2.10/include/memdebug.h:1.3
--- ircu2.10/include/memdebug.h:1.2     Sun May  9 18:32:52 2004
+++ ircu2.10/include/memdebug.h Wed Jan 26 20:07:45 2005
@@ -4,3 +4,5 @@
 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: ircu2.10/ircd/Makefile.in
diff -u ircu2.10/ircd/Makefile.in:1.65 ircu2.10/ircd/Makefile.in:1.66
--- ircu2.10/ircd/Makefile.in:1.65      Mon Jan  3 16:17:11 2005
+++ ircu2.10/ircd/Makefile.in   Wed Jan 26 20:07:45 2005
@@ -79,6 +79,7 @@
 UMKPASSWD_SRC = ${CRYPTO_SRC} \
        ircd_alloc.c \
        ircd_string.c \
+       memdebug.c \
        umkpasswd.c
 
 IRCD_SRC = \
Index: ircu2.10/ircd/ircd_alloc.c
diff -u ircu2.10/ircd/ircd_alloc.c:1.9 ircu2.10/ircd/ircd_alloc.c:1.10
--- ircu2.10/ircd/ircd_alloc.c:1.9      Fri Dec 10 21:13:44 2004
+++ ircu2.10/ircd/ircd_alloc.c  Wed Jan 26 20:07:46 2005
@@ -21,7 +21,7 @@
  */
 /** @file
  * @brief IRC daemon memory allocation functions.
- * @version $Id: ircd_alloc.c,v 1.9 2004/12/11 05:13:44 klmitch Exp $
+ * @version $Id: ircd_alloc.c,v 1.10 2005/01/27 04:07:46 entrope Exp $
  */
 #include "config.h"
 
@@ -57,6 +57,7 @@
   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 @@
     (*noMemHandler)();
   return t;
 }
+#endif
Index: ircu2.10/ircd/memdebug.c
diff -u ircu2.10/ircd/memdebug.c:1.5 ircu2.10/ircd/memdebug.c:1.6
--- ircu2.10/ircd/memdebug.c:1.5        Fri Dec 10 21:14:04 2004
+++ ircu2.10/ircd/memdebug.c    Wed Jan 26 20:07:46 2005
@@ -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: ircu2.10/ircd/umkpasswd.c
diff -u ircu2.10/ircd/umkpasswd.c:1.5 ircu2.10/ircd/umkpasswd.c:1.6
--- ircu2.10/ircd/umkpasswd.c:1.5       Fri Dec 10 21:14:07 2004
+++ ircu2.10/ircd/umkpasswd.c   Wed Jan 26 20:07:46 2005
@@ -16,7 +16,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: umkpasswd.c,v 1.5 2004/12/11 05:14:07 klmitch Exp $
+ * $Id: umkpasswd.c,v 1.6 2005/01/27 04:07:46 entrope Exp $
 */
 #include "config.h"
 #include <unistd.h>
@@ -46,6 +46,13 @@
 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)
 {
----------------------- End of diff -----------------------

Reply via email to