aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-10-03 20:20:38 +0000
committerNick Mathewson <nickm@torproject.org>2005-10-03 20:20:38 +0000
commitc5ee3e961ef1556ed62449211adf9db6ef5150ca (patch)
tree77bd69d9ee2fe57923ba2c83d753324c6003a389 /src/common/util.c
parent9e54e2e2931a4c86ff13b70a8a04024f83cd67a2 (diff)
downloadtor-c5ee3e961ef1556ed62449211adf9db6ef5150ca.tar
tor-c5ee3e961ef1556ed62449211adf9db6ef5150ca.tar.gz
Reorganize some quick-and-dirty code to find out what openssl stuff is leaking, using dmalloc.
svn:r5178
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 07e26d85f..b2457a4f3 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -96,7 +96,7 @@ const char util_c_id[] = "$Id$";
* ===== */
#ifdef USE_DMALLOC
#include <dmalloc.h>
- #define DMALLOC_FN_ARGS file, line,
+ #define DMALLOC_FN_ARGS , file, line
#else
#define dmalloc_strdup(file, line, string, xalloc_b) strdup(string)
@@ -116,7 +116,7 @@ const char util_c_id[] = "$Id$";
* ignored otherwise.
*/
void *
-_tor_malloc(DMALLOC_PARAMS size_t size)
+_tor_malloc(size_t size DMALLOC_PARAMS)
{
void *result;
@@ -141,9 +141,9 @@ _tor_malloc(DMALLOC_PARAMS size_t size)
* the process on error. (Same as calloc(size,1), but never returns NULL.)
*/
void *
-_tor_malloc_zero(DMALLOC_PARAMS size_t size)
+_tor_malloc_zero(size_t size DMALLOC_PARAMS)
{
- void *result = _tor_malloc(DMALLOC_FN_ARGS size);
+ void *result = _tor_malloc(size DMALLOC_FN_ARGS);
memset(result, 0, size);
return result;
}
@@ -153,7 +153,7 @@ _tor_malloc_zero(DMALLOC_PARAMS size_t size)
* terminate. (Like realloc(ptr,size), but never returns NULL.)
*/
void *
-_tor_realloc(DMALLOC_PARAMS void *ptr, size_t size)
+_tor_realloc(void *ptr, size_t size DMALLOC_PARAMS)
{
void *result;
@@ -170,7 +170,7 @@ _tor_realloc(DMALLOC_PARAMS void *ptr, size_t size)
* NULL.)
*/
char *
-_tor_strdup(DMALLOC_PARAMS const char *s)
+_tor_strdup(const char *s DMALLOC_PARAMS)
{
char *dup;
tor_assert(s);
@@ -190,11 +190,11 @@ _tor_strdup(DMALLOC_PARAMS const char *s)
* NULL.)
*/
char *
-_tor_strndup(DMALLOC_PARAMS const char *s, size_t n)
+_tor_strndup(const char *s, size_t n DMALLOC_PARAMS)
{
char *dup;
tor_assert(s);
- dup = _tor_malloc(DMALLOC_FN_ARGS n+1);
+ dup = _tor_malloc((n+1) DMALLOC_FN_ARGS);
/* Performance note: Ordinarily we prefer strlcpy to strncpy. But
* this function gets called a whole lot, and platform strncpy is
* much faster than strlcpy when strlen(s) is much longer than n.