Make the remaining LHASH macro changes. This should leave no remaining
authorGeoff Thorpe <geoff@openssl.org>
Mon, 4 Dec 2000 03:02:44 +0000 (03:02 +0000)
committerGeoff Thorpe <geoff@openssl.org>
Mon, 4 Dec 2000 03:02:44 +0000 (03:02 +0000)
cases of function pointer casting in lh_new() calls - and leave only the
lh_doall and lh_doall_arg cases to be finished.

crypto/conf/conf_api.c
crypto/err/err.c
crypto/mem_dbg.c
crypto/objects/o_names.c
crypto/objects/obj_dat.c
ssl/ssl_lib.c

index 4d30c6835ce0b906eac349a55963ddfa3e72af8a..64bbd971ab259b79f668ece46c83f1b37790dcfa 100644 (file)
@@ -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;
                        }
index 34f4adaeb2969fd440339a04a754ed0067755e6b..3b4de23775f70f9641e7560e462c4f9f7198f620 100644 (file)
@@ -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
index eb45516bdbbecc57d731ff8cf96d1d5fc0621ca9..56ce7dddea60d1d03a433d30590e1776c00613f8 100644 (file)
@@ -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);
index db37ccf47c6d8cebf73d5ab649c0d3780c5c60c8..ccf3a18726d781c3d047d02bd951377fa778ccf1 100644 (file)
@@ -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);
        }
index e5c7ab7b660093d0f1df6958f7272b3c93e0499b..6eb9f4886123ee0a692fad8d3790feef7c60b39c 100644 (file)
@@ -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);
        }
 
index 237235345537930e8e32dbda10e643cf30deec3d..685fc5560a76d36ed5b4951bc9853e07d84fa0ec 100644 (file)
@@ -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;