gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r3643 - in branches/GNUnet-0.7.0: . src/util


From: durner
Subject: [GNUnet-SVN] r3643 - in branches/GNUnet-0.7.0: . src/util
Date: Sat, 4 Nov 2006 09:31:43 -0800 (PST)

Author: durner
Date: 2006-11-04 09:31:35 -0800 (Sat, 04 Nov 2006)
New Revision: 3643

Added:
   branches/GNUnet-0.7.0/src/util/dlmalloc.c
   branches/GNUnet-0.7.0/src/util/dlmalloc.h
Modified:
   branches/GNUnet-0.7.0/configure.ac
   branches/GNUnet-0.7.0/src/util/Makefile.am
   branches/GNUnet-0.7.0/src/util/xmalloc.c
Log:
add dlmalloc

Modified: branches/GNUnet-0.7.0/configure.ac
===================================================================
--- branches/GNUnet-0.7.0/configure.ac  2006-11-04 16:17:41 UTC (rev 3642)
+++ branches/GNUnet-0.7.0/configure.ac  2006-11-04 17:31:35 UTC (rev 3643)
@@ -403,7 +403,7 @@
 AC_HEADER_SYS_WAIT
 AC_TYPE_OFF_T
 AC_TYPE_UID_T
-AC_CHECK_FUNCS([floor gethostname memmove rmdir strncasecmp strrchr strtol 
atoll dup2 fdatasync ftruncate gethostbyname gettimeofday memset mkdir mkfifo 
select socket strcasecmp strchr strdup strerror strstr clock_gettime getrusage 
rand uname setlocale getcwd mktime gmtime_r gmtime strlcpy strlcat ftruncate 
stat64])
+AC_CHECK_FUNCS([floor gethostname memmove rmdir strncasecmp strrchr strtol 
atoll dup2 fdatasync ftruncate gethostbyname gettimeofday memset mkdir mkfifo 
select socket strcasecmp strchr strdup strerror strstr clock_gettime getrusage 
rand uname setlocale getcwd mktime gmtime_r gmtime strlcpy strlcat ftruncate 
stat64 sbrk mmap mremap])
 
 # restore LIBS
 LIBS=$SAVE_LIBS

Modified: branches/GNUnet-0.7.0/src/util/Makefile.am
===================================================================
--- branches/GNUnet-0.7.0/src/util/Makefile.am  2006-11-04 16:17:41 UTC (rev 
3642)
+++ branches/GNUnet-0.7.0/src/util/Makefile.am  2006-11-04 17:31:35 UTC (rev 
3643)
@@ -50,6 +50,8 @@
  configuration.c \
  cron.c \
  daemon.c \
+ dlmalloc.c \
+ dlmalloc.h \
  dso.c \
  getopt.c \
  hashing.c \

Copied: branches/GNUnet-0.7.0/src/util/dlmalloc.c (from rev 3636, 
GNUnet/src/util/string/dlmalloc.c)

Copied: branches/GNUnet-0.7.0/src/util/dlmalloc.h (from rev 3636, 
GNUnet/src/util/string/dlmalloc.h)

Modified: branches/GNUnet-0.7.0/src/util/xmalloc.c
===================================================================
--- branches/GNUnet-0.7.0/src/util/xmalloc.c    2006-11-04 16:17:41 UTC (rev 
3642)
+++ branches/GNUnet-0.7.0/src/util/xmalloc.c    2006-11-04 17:31:35 UTC (rev 
3643)
@@ -26,7 +26,10 @@
 
 #include "gnunet_util.h"
 #include "platform.h"
+#include "dlmalloc.h"
 
+/* #define USE_DLMALLOC */
+
 #ifndef INT_MAX
 #define INT_MAX 0x7FFFFFFF
 #endif
@@ -60,7 +63,11 @@
   void * result;
 
   GNUNET_ASSERT(size < INT_MAX);
+#ifdef USE_DLMALLOC
+  result = dlmalloc(size);
+#else
   result = malloc(size);
+#endif
   if (result == NULL)
     DIE_STRERROR_FL(filename, linenumber, "malloc");
   memset(result, 0, size); /* client code should not rely on this, though... */
@@ -83,8 +90,11 @@
                 const size_t n,
                 const char * filename,
                 const int linenumber) {
+#ifdef USE_DLMALLOC
+  ptr = dlrealloc(ptr, n);
+#else
   ptr = realloc(ptr, n);
-
+#endif
   if (!ptr)
     DIE_STRERROR_FL(filename, linenumber, "realloc");
   return ptr;
@@ -103,7 +113,11 @@
            const int linenumber) {
   GNUNET_ASSERT_FL(ptr != NULL,
                   filename, linenumber);
+#ifdef USE_DLMALLOC
+  dlfree(ptr);
+#else
   free(ptr);
+#endif
 }
 
 /**





reply via email to

[Prev in Thread] Current Thread [Next in Thread]