Loading contrib/checkSpace.pl +5 −4 Original line number Diff line number Diff line Loading @@ -82,14 +82,15 @@ for $fn (@ARGV) { } } ## Warn about functions not declared at start of line. if ($in_func_head || ($fn !~ /\.h$/ && /^[a-zA-Z0-9_]/ && ! /^(?:static )?(?:typedef|struct|union)/ && if ($in_func_head || ($fn !~ /\.h$/ && /^[a-zA-Z0-9_]/ && ! /^(?:static )?(?:typedef|struct|union)[^\(]*$/ && ! /= *\{$/ && ! /;$/)) { if (/.\{$/){ print "fn() {:$fn:$.\n"; $in_func_head = 0; } elsif (/^\S[^\(]* +[a-zA-Z0-9_]+\(/) { } elsif (/^\S[^\(]* +\**[a-zA-Z0-9_]+\(/) { $in_func_head = -1; # started with tp fn } elsif (/;$/) { $in_func_head = 0; Loading src/common/container.c +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading src/common/crypto.c +12 −6 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; Loading @@ -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; } Loading @@ -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; Loading Loading @@ -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; Loading src/common/util.c +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading src/common/util.h +11 −0 Original line number Diff line number Diff line Loading @@ -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) Loading Loading
contrib/checkSpace.pl +5 −4 Original line number Diff line number Diff line Loading @@ -82,14 +82,15 @@ for $fn (@ARGV) { } } ## Warn about functions not declared at start of line. if ($in_func_head || ($fn !~ /\.h$/ && /^[a-zA-Z0-9_]/ && ! /^(?:static )?(?:typedef|struct|union)/ && if ($in_func_head || ($fn !~ /\.h$/ && /^[a-zA-Z0-9_]/ && ! /^(?:static )?(?:typedef|struct|union)[^\(]*$/ && ! /= *\{$/ && ! /;$/)) { if (/.\{$/){ print "fn() {:$fn:$.\n"; $in_func_head = 0; } elsif (/^\S[^\(]* +[a-zA-Z0-9_]+\(/) { } elsif (/^\S[^\(]* +\**[a-zA-Z0-9_]+\(/) { $in_func_head = -1; # started with tp fn } elsif (/;$/) { $in_func_head = 0; Loading
src/common/container.c +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading
src/common/crypto.c +12 −6 Original line number Diff line number Diff line Loading @@ -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); Loading @@ -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; Loading @@ -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; } Loading @@ -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; Loading Loading @@ -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; Loading
src/common/util.c +2 −1 Original line number Diff line number Diff line Loading @@ -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; Loading
src/common/util.h +11 −0 Original line number Diff line number Diff line Loading @@ -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) Loading