mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-20 13:34:51 +01:00
even better function start checks; give dmalloc a chance of working.
svn:r5162
This commit is contained in:
parent
edd15cb781
commit
26e7a05725
6 changed files with 34 additions and 13 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue