summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2000-12-04 03:02:44 +0000
committerGeoff Thorpe <geoff@openssl.org>2000-12-04 03:02:44 +0000
commit97b1719583b3b0e096fdba29573678ac6fd6bae3 (patch)
tree3b3f24532f736677ac53571f55dfe0ef8935be63
parentb0dc680f71db4f79c01b41975f869f7346542098 (diff)
Make the remaining LHASH macro changes. This should leave no remaining
cases of function pointer casting in lh_new() calls - and leave only the lh_doall and lh_doall_arg cases to be finished.
-rw-r--r--crypto/conf/conf_api.c7
-rw-r--r--crypto/err/err.c14
-rw-r--r--crypto/mem_dbg.c14
-rw-r--r--crypto/objects/o_names.c7
-rw-r--r--crypto/objects/obj_dat.c5
-rw-r--r--ssl/ssl_lib.c7
6 files changed, 39 insertions, 15 deletions
diff --git a/crypto/conf/conf_api.c b/crypto/conf/conf_api.c
index 4d30c6835c..64bbd971ab 100644
--- a/crypto/conf/conf_api.c
+++ b/crypto/conf/conf_api.c
@@ -73,6 +73,9 @@ static void value_free_stack(CONF_VALUE *a,LHASH *conf);
static unsigned long hash(CONF_VALUE *v);
static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b);
+static IMPLEMENT_LHASH_HASH_FN(hash, CONF_VALUE *)
+static IMPLEMENT_LHASH_COMP_FN(cmp_conf, CONF_VALUE *)
+
/* Up until OpenSSL 0.9.5a, this was get_section */
CONF_VALUE *_CONF_get_section(CONF *conf, char *section)
{
@@ -181,8 +184,8 @@ int _CONF_new_data(CONF *conf)
return 0;
}
if (conf->data == NULL)
- if ((conf->data = lh_new((LHASH_HASH_FN_TYPE)hash,
- (LHASH_COMP_FN_TYPE)cmp_conf)) == NULL)
+ if ((conf->data = lh_new(LHASH_HASH_FN(hash),
+ LHASH_COMP_FN(cmp_conf))) == NULL)
{
return 0;
}
diff --git a/crypto/err/err.c b/crypto/err/err.c
index 34f4adaeb2..3b4de23775 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -129,6 +129,12 @@ static unsigned long pid_hash(ERR_STATE *pid);
static int pid_cmp(ERR_STATE *a,ERR_STATE *pid);
static unsigned long get_error_values(int inc,const char **file,int *line,
const char **data,int *flags);
+
+static IMPLEMENT_LHASH_HASH_FN(err_hash, ERR_STRING_DATA *)
+static IMPLEMENT_LHASH_COMP_FN(err_cmp, ERR_STRING_DATA *)
+static IMPLEMENT_LHASH_HASH_FN(pid_hash, ERR_STATE *)
+static IMPLEMENT_LHASH_COMP_FN(pid_cmp, ERR_STATE *)
+
static void ERR_STATE_free(ERR_STATE *s);
#ifndef NO_ERR
static ERR_STRING_DATA ERR_str_libraries[]=
@@ -316,8 +322,8 @@ void ERR_load_strings(int lib, ERR_STRING_DATA *str)
if (error_hash == NULL)
{
CRYPTO_w_lock(CRYPTO_LOCK_ERR_HASH);
- error_hash=lh_new((LHASH_HASH_FN_TYPE)err_hash,
- (LHASH_COMP_FN_TYPE)err_cmp);
+ error_hash=lh_new(LHASH_HASH_FN(err_hash),
+ LHASH_COMP_FN(err_cmp));
if (error_hash == NULL)
{
CRYPTO_w_unlock(CRYPTO_LOCK_ERR_HASH);
@@ -707,8 +713,8 @@ ERR_STATE *ERR_get_state(void)
/* no entry yet in thread_hash for current thread -
* thus, it may have changed since we last looked at it */
if (thread_hash == NULL)
- thread_hash = lh_new((LHASH_HASH_FN_TYPE)pid_hash,
- (LHASH_COMP_FN_TYPE)pid_cmp);
+ thread_hash = lh_new(LHASH_HASH_FN(pid_hash),
+ LHASH_COMP_FN(pid_cmp));
if (thread_hash == NULL)
thread_state_exists = 0; /* allocation error */
else
diff --git a/crypto/mem_dbg.c b/crypto/mem_dbg.c
index eb45516bdb..56ce7dddea 100644
--- a/crypto/mem_dbg.c
+++ b/crypto/mem_dbg.c
@@ -234,6 +234,9 @@ static unsigned long mem_hash(MEM *a)
return(ret);
}
+static IMPLEMENT_LHASH_HASH_FN(mem_hash, MEM *)
+static IMPLEMENT_LHASH_COMP_FN(mem_cmp, MEM *)
+
static int app_info_cmp(APP_INFO *a, APP_INFO *b)
{
return(a->thread != b->thread);
@@ -249,6 +252,9 @@ static unsigned long app_info_hash(APP_INFO *a)
return(ret);
}
+static IMPLEMENT_LHASH_HASH_FN(app_info_hash, APP_INFO *)
+static IMPLEMENT_LHASH_COMP_FN(app_info_cmp, APP_INFO *)
+
static APP_INFO *pop_info(void)
{
APP_INFO tmp;
@@ -302,8 +308,8 @@ int CRYPTO_push_info_(const char *info, const char *file, int line)
}
if (amih == NULL)
{
- if ((amih=lh_new((LHASH_HASH_FN_TYPE)app_info_hash,
- (LHASH_COMP_FN_TYPE)app_info_cmp)) == NULL)
+ if ((amih=lh_new(LHASH_HASH_FN(app_info_hash),
+ LHASH_COMP_FN(app_info_cmp))) == NULL)
{
OPENSSL_free(ami);
ret=0;
@@ -395,8 +401,8 @@ void CRYPTO_dbg_malloc(void *addr, int num, const char *file, int line,
}
if (mh == NULL)
{
- if ((mh=lh_new((LHASH_HASH_FN_TYPE)mem_hash,
- (LHASH_COMP_FN_TYPE)mem_cmp)) == NULL)
+ if ((mh=lh_new(LHASH_HASH_FN(mem_hash),
+ LHASH_COMP_FN(mem_cmp))) == NULL)
{
OPENSSL_free(addr);
OPENSSL_free(m);
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c
index db37ccf47c..ccf3a18726 100644
--- a/crypto/objects/o_names.c
+++ b/crypto/objects/o_names.c
@@ -27,12 +27,15 @@ static STACK_OF(NAME_FUNCS) *name_funcs_stack;
static unsigned long obj_name_hash(OBJ_NAME *a);
static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b);
+static IMPLEMENT_LHASH_HASH_FN(obj_name_hash, OBJ_NAME *)
+static IMPLEMENT_LHASH_COMP_FN(obj_name_cmp, OBJ_NAME *)
+
int OBJ_NAME_init(void)
{
if (names_lh != NULL) return(1);
MemCheck_off();
- names_lh=lh_new((LHASH_HASH_FN_TYPE)obj_name_hash,
- (LHASH_COMP_FN_TYPE)obj_name_cmp);
+ names_lh=lh_new(LHASH_HASH_FN(obj_name_hash),
+ LHASH_COMP_FN(obj_name_cmp));
MemCheck_on();
return(names_lh != NULL);
}
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index e5c7ab7b66..6eb9f48861 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -174,10 +174,13 @@ static int add_cmp(ADDED_OBJ *ca, ADDED_OBJ *cb)
return(1); /* should not get here */
}
+static IMPLEMENT_LHASH_HASH_FN(add_hash, ADDED_OBJ *)
+static IMPLEMENT_LHASH_COMP_FN(add_cmp, ADDED_OBJ *)
+
static int init_added(void)
{
if (added != NULL) return(1);
- added=lh_new((LHASH_HASH_FN_TYPE)add_hash,(LHASH_COMP_FN_TYPE)add_cmp);
+ added=lh_new(LHASH_HASH_FN(add_hash),LHASH_COMP_FN(add_cmp));
return(added != NULL);
}
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 2372353455..685fc5560a 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -1101,6 +1101,9 @@ int SSL_SESSION_cmp(SSL_SESSION *a,SSL_SESSION *b)
return(memcmp(a->session_id,b->session_id,a->session_id_length));
}
+static IMPLEMENT_LHASH_HASH_FN(SSL_SESSION_hash, SSL_SESSION *)
+static IMPLEMENT_LHASH_COMP_FN(SSL_SESSION_cmp, SSL_SESSION *)
+
SSL_CTX *SSL_CTX_new(SSL_METHOD *meth)
{
SSL_CTX *ret=NULL;
@@ -1164,8 +1167,8 @@ SSL_CTX *SSL_CTX_new(SSL_METHOD *meth)
ret->default_passwd_callback_userdata=NULL;
ret->client_cert_cb=NULL;
- ret->sessions=lh_new((LHASH_HASH_FN_TYPE)SSL_SESSION_hash,
- (LHASH_COMP_FN_TYPE)SSL_SESSION_cmp);
+ ret->sessions=lh_new(LHASH_HASH_FN(SSL_SESSION_hash),
+ LHASH_COMP_FN(SSL_SESSION_cmp));
if (ret->sessions == NULL) goto err;
ret->cert_store=X509_STORE_new();
if (ret->cert_store == NULL) goto err;