aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/container.c3
-rw-r--r--src/common/crypto.c18
-rw-r--r--src/common/util.c3
-rw-r--r--src/common/util.h11
-rw-r--r--src/or/rephist.c3
5 files changed, 29 insertions, 9 deletions
diff --git a/src/common/container.c b/src/common/container.c
index 436c4bc01..39cabe9c5 100644
--- a/src/common/container.c
+++ b/src/common/container.c
@@ -550,7 +550,8 @@ strmap_set(strmap_t *map, const char *key, void *val)
/** Return the current value associated with <b>key</b>, or NULL if no
* value is set.
*/
-void *strmap_get(strmap_t *map, const char *key)
+void *
+strmap_get(strmap_t *map, const char *key)
{
strmap_entry_t *resolve;
strmap_entry_t search;
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 7967e1f16..38e9931f8 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -242,7 +242,8 @@ crypto_global_cleanup(void)
}
/** used by tortls.c: wrap an RSA* in a crypto_pk_env_t. */
-crypto_pk_env_t *_crypto_new_pk_env_rsa(RSA *rsa)
+crypto_pk_env_t *
+_crypto_new_pk_env_rsa(RSA *rsa)
{
crypto_pk_env_t *env;
tor_assert(rsa);
@@ -253,14 +254,16 @@ crypto_pk_env_t *_crypto_new_pk_env_rsa(RSA *rsa)
}
/** used by tortls.c: return the RSA* from a crypto_pk_env_t. */
-RSA *_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
+RSA *
+_crypto_pk_env_get_rsa(crypto_pk_env_t *env)
{
return env->key;
}
/** used by tortls.c: get an equivalent EVP_PKEY* for a crypto_pk_env_t. Iff
* private is set, include the private-key portion of the key. */
-EVP_PKEY *_crypto_pk_env_get_evp_pkey(crypto_pk_env_t *env, int private)
+EVP_PKEY *
+_crypto_pk_env_get_evp_pkey(crypto_pk_env_t *env, int private)
{
RSA *key = NULL;
EVP_PKEY *pkey = NULL;
@@ -287,7 +290,8 @@ EVP_PKEY *_crypto_pk_env_get_evp_pkey(crypto_pk_env_t *env, int private)
/** Used by tortls.c: Get the DH* from a crypto_dh_env_t.
*/
-DH *_crypto_dh_env_get_dh(crypto_dh_env_t *dh)
+DH *
+_crypto_dh_env_get_dh(crypto_dh_env_t *dh)
{
return dh->dh;
}
@@ -295,7 +299,8 @@ DH *_crypto_dh_env_get_dh(crypto_dh_env_t *dh)
/** Allocate and return storage for a public key. The key itself will not yet
* be set.
*/
-crypto_pk_env_t *crypto_new_pk_env(void)
+crypto_pk_env_t *
+crypto_new_pk_env(void)
{
RSA *rsa;
@@ -358,7 +363,8 @@ crypto_create_init_cipher(const char *key, int encrypt_mode)
/** Allocate and return a new symmetric cipher.
*/
-crypto_cipher_env_t *crypto_new_cipher_env(void)
+crypto_cipher_env_t *
+crypto_new_cipher_env(void)
{
crypto_cipher_env_t *env;
diff --git a/src/common/util.c b/src/common/util.c
index f8da6768a..07e26d85f 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -115,7 +115,8 @@ const char util_c_id[] = "$Id$";
* <b>file</b> and <b>line</b> are used if dmalloc is enabled, and
* ignored otherwise.
*/
-void *_tor_malloc(DMALLOC_PARAMS size_t size)
+void *
+_tor_malloc(DMALLOC_PARAMS size_t size)
{
void *result;
diff --git a/src/common/util.h b/src/common/util.h
index c4227b6d1..e644940b8 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -66,7 +66,18 @@ void *_tor_malloc_zero(DMALLOC_PARAMS size_t size);
void *_tor_realloc(DMALLOC_PARAMS void *ptr, size_t size);
char *_tor_strdup(DMALLOC_PARAMS const char *s);
char *_tor_strndup(DMALLOC_PARAMS const char *s, size_t n);
+#ifdef USE_DMALLOC
+extern int dmalloc_free(const char *file, const int line, void *pnt,
+ const int func_id);
+#define tor_free(p) do { \
+ if (p) { \
+ dmalloc_free(_SHORT_FILE_, __LINE__, (p), 0); \
+ (p)=NULL; \
+ } \
+ } while (0)
+#else
#define tor_free(p) do { if (p) {free(p); (p)=NULL;} } while (0)
+#endif
#define tor_malloc(size) _tor_malloc(DMALLOC_ARGS size)
#define tor_malloc_zero(size) _tor_malloc_zero(DMALLOC_ARGS size)
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 85532a3e6..2ea39497c 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -484,7 +484,8 @@ add_obs(bw_array_t *b, time_t when, int n)
/** Allocate, initialize, and return a new bw_array.
*/
-static bw_array_t *bw_array_new(void)
+static bw_array_t *
+bw_array_new(void)
{
bw_array_t *b;
time_t start;