diff options
author | Geoff Thorpe <geoff@openssl.org> | 2001-09-02 20:41:34 +0000 |
---|---|---|
committer | Geoff Thorpe <geoff@openssl.org> | 2001-09-02 20:41:34 +0000 |
commit | 72849dce817d3bec5e40b73ea295ac4f1e9fc98e (patch) | |
tree | 9d77bdc790d7cd7bcb55748024b886fb17fb4756 | |
parent | 26188931147826e280c73ac2692081ce230885c6 (diff) |
Convert "max" to "mx" for variable names (brought to my attention by Steve
Henson). Also, reverse a previous change that used an implicit function
pointer cast rather than an explicit data pointer cast in the STACK cleanup
code.
-rw-r--r-- | crypto/ex_data.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/crypto/ex_data.c b/crypto/ex_data.c index 56bd8cf0c2..da4d8a416d 100644 --- a/crypto/ex_data.c +++ b/crypto/ex_data.c @@ -226,9 +226,10 @@ static int ex_data_check(void) #define EX_DATA_CHECK(iffail) if(!ex_data && !ex_data_check()) {iffail} /* This "inner" callback is used by the callback function that follows it */ -static void def_cleanup_util_cb(CRYPTO_EX_DATA_FUNCS *v) +static void def_cleanup_util_cb(void *v) { - OPENSSL_free(v); + CRYPTO_EX_DATA_FUNCS *funcs = (CRYPTO_EX_DATA_FUNCS *)v; + OPENSSL_free(funcs); } /* This callback is used in lh_doall to destroy all EX_CLASS_ITEM values from @@ -349,7 +350,7 @@ static int int_get_new_index(int class_index, long argl, void *argp, static int int_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) { - int max,i; + int mx,i; void *ptr; CRYPTO_EX_DATA_FUNCS **storage = NULL; EX_CLASS_ITEM *item = def_get_class(class_index); @@ -358,23 +359,23 @@ static int int_new_ex_data(int class_index, void *obj, return 0; ad->sk = NULL; CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); - max = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); - if(max > 0) + mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); + if(mx > 0) { - storage = OPENSSL_malloc(max * sizeof(CRYPTO_EX_DATA_FUNCS*)); + storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); if(!storage) goto skip; - for(i = 0; i < max; i++) + for(i = 0; i < mx; i++) storage[i] = sk_CRYPTO_EX_DATA_FUNCS_value(item->meth,i); } skip: CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA); - if((max > 0) && !storage) + if((mx > 0) && !storage) { CRYPTOerr(CRYPTO_F_INT_NEW_EX_DATA,ERR_R_MALLOC_FAILURE); return 0; } - for(i = 0; i < max; i++) + for(i = 0; i < mx; i++) { if(storage[i] && storage[i]->new_func) { @@ -392,7 +393,7 @@ skip: static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from) { - int max, j, i; + int mx, j, i; char *ptr; CRYPTO_EX_DATA_FUNCS **storage = NULL; EX_CLASS_ITEM *item; @@ -402,26 +403,26 @@ static int int_dup_ex_data(int class_index, CRYPTO_EX_DATA *to, if((item = def_get_class(class_index)) == NULL) return 0; CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); - max = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); + mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); j = sk_num(from->sk); - if(j < max) - max = j; - if(max > 0) + if(j < mx) + mx = j; + if(mx > 0) { - storage = OPENSSL_malloc(max * sizeof(CRYPTO_EX_DATA_FUNCS*)); + storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); if(!storage) goto skip; - for(i = 0; i < max; i++) + for(i = 0; i < mx; i++) storage[i] = sk_CRYPTO_EX_DATA_FUNCS_value(item->meth,i); } skip: CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA); - if((max > 0) && !storage) + if((mx > 0) && !storage) { CRYPTOerr(CRYPTO_F_INT_DUP_EX_DATA,ERR_R_MALLOC_FAILURE); return 0; } - for(i = 0; i < max; i++) + for(i = 0; i < mx; i++) { ptr = CRYPTO_get_ex_data(from, i); if(storage[i] && storage[i]->dup_func) @@ -438,30 +439,30 @@ skip: static void int_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad) { - int max,i; + int mx,i; EX_CLASS_ITEM *item; void *ptr; CRYPTO_EX_DATA_FUNCS **storage = NULL; if((item = def_get_class(class_index)) == NULL) return; CRYPTO_r_lock(CRYPTO_LOCK_EX_DATA); - max = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); - if(max > 0) + mx = sk_CRYPTO_EX_DATA_FUNCS_num(item->meth); + if(mx > 0) { - storage = OPENSSL_malloc(max * sizeof(CRYPTO_EX_DATA_FUNCS*)); + storage = OPENSSL_malloc(mx * sizeof(CRYPTO_EX_DATA_FUNCS*)); if(!storage) goto skip; - for(i = 0; i < max; i++) + for(i = 0; i < mx; i++) storage[i] = sk_CRYPTO_EX_DATA_FUNCS_value(item->meth,i); } skip: CRYPTO_r_unlock(CRYPTO_LOCK_EX_DATA); - if((max > 0) && !storage) + if((mx > 0) && !storage) { CRYPTOerr(CRYPTO_F_INT_FREE_EX_DATA,ERR_R_MALLOC_FAILURE); return; } - for(i = 0; i < max; i++) + for(i = 0; i < mx; i++) { if(storage[i] && storage[i]->free_func) { |