Add --with-dmalloc configure option

svn:r3508
This commit is contained in:
Peter Palfrader
2005-02-03 07:25:10 +00:00
parent dfa3a0220f
commit ddd724ef94
4 changed files with 59 additions and 15 deletions
+11 -5
View File
@@ -47,13 +47,19 @@
#endif
/* Memory management */
void *tor_malloc(size_t size);
void *tor_malloc_zero(size_t size);
void *tor_realloc(void *ptr, size_t size);
char *tor_strdup(const char *s);
char *tor_strndup(const char *s, size_t n);
void *_tor_malloc(const char *file, const int line, size_t size);
void *_tor_malloc_zero(const char *file, const int line, size_t size);
void *_tor_realloc(const char *file, const int line, void *ptr, size_t size);
char *_tor_strdup(const char *file, const int line, const char *s);
char *_tor_strndup(const char *file, const int line, const char *s, size_t n);
#define tor_free(p) do { if (p) {free(p); (p)=NULL;} } while (0)
#define tor_malloc(size) _tor_malloc(_SHORT_FILE_, __LINE__, size)
#define tor_malloc_zero(size) _tor_malloc_zero(_SHORT_FILE_, __LINE__, size)
#define tor_realloc(ptr, size) _tor_realloc(_SHORT_FILE_, __LINE__, ptr, size)
#define tor_strdup(s) _tor_strdup(_SHORT_FILE_, __LINE__, s)
#define tor_strndup(s, n) _tor_strndup(_SHORT_FILE_, __LINE__, s, n)
/* String manipulation */
#define HEX_CHARACTERS "0123456789ABCDEFabcdef"
void tor_strlower(char *s);