aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/objects
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2000-12-01 20:31:52 +0000
committerGeoff Thorpe <geoff@openssl.org>2000-12-01 20:31:52 +0000
commit385d81380cb8aa062b9d7e2c678419623c7db484 (patch)
treef866963b5b03410694d03a37d20695327a72a460 /crypto/objects
parent862e973b50e56d9510cfebc220cf410d3d5e99bc (diff)
downloadopenssl-385d81380cb8aa062b9d7e2c678419623c7db484.tar.gz
First step in tidying up the LHASH code. The callback prototypes (and
casts) used in the lhash code are about as horrible and evil as they can be. For starters, the callback prototypes contain empty parameter lists. Yuck. This first change defines clearer prototypes - including "typedef"'d function pointer types to use as "hash" and "compare" callbacks, as well as the callbacks passed to the lh_doall and lh_doall_arg iteration functions. Now at least more explicit (and clear) casting is required in all of the dependant code - and that should be included in this commit. The next step will be to hunt down and obliterate some of the function pointer casting being used when it's not necessary - a particularly evil variant exists in the implementation of lh_doall.
Diffstat (limited to 'crypto/objects')
-rw-r--r--crypto/objects/o_names.c7
-rw-r--r--crypto/objects/obj_dat.c8
2 files changed, 8 insertions, 7 deletions
diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c
index 288f008149..db37ccf47c 100644
--- a/crypto/objects/o_names.c
+++ b/crypto/objects/o_names.c
@@ -31,7 +31,8 @@ int OBJ_NAME_init(void)
{
if (names_lh != NULL) return(1);
MemCheck_off();
- names_lh=lh_new(obj_name_hash,obj_name_cmp);
+ names_lh=lh_new((LHASH_HASH_FN_TYPE)obj_name_hash,
+ (LHASH_COMP_FN_TYPE)obj_name_cmp);
MemCheck_on();
return(names_lh != NULL);
}
@@ -245,7 +246,7 @@ void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg),void *arg)
d.fn=fn;
d.arg=arg;
- lh_doall_arg(names_lh,do_all_fn,&d);
+ lh_doall_arg(names_lh,(LHASH_DOALL_ARG_FN_TYPE)do_all_fn,&d);
}
struct doall_sorted
@@ -320,7 +321,7 @@ void OBJ_NAME_cleanup(int type)
down_load=names_lh->down_load;
names_lh->down_load=0;
- lh_doall(names_lh,names_lh_free);
+ lh_doall(names_lh,(LHASH_DOALL_FN_TYPE)names_lh_free);
if (type < 0)
{
lh_free(names_lh);
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index 4b1bb9583a..e5c7ab7b66 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -177,7 +177,7 @@ static int add_cmp(ADDED_OBJ *ca, ADDED_OBJ *cb)
static int init_added(void)
{
if (added != NULL) return(1);
- added=lh_new(add_hash,add_cmp);
+ added=lh_new((LHASH_HASH_FN_TYPE)add_hash,(LHASH_COMP_FN_TYPE)add_cmp);
return(added != NULL);
}
@@ -203,9 +203,9 @@ void OBJ_cleanup(void)
{
if (added == NULL) return;
added->down_load=0;
- lh_doall(added,cleanup1); /* zero counters */
- lh_doall(added,cleanup2); /* set counters */
- lh_doall(added,cleanup3); /* free objects */
+ lh_doall(added,(LHASH_DOALL_FN_TYPE)cleanup1); /* zero counters */
+ lh_doall(added,(LHASH_DOALL_FN_TYPE)cleanup2); /* set counters */
+ lh_doall(added,(LHASH_DOALL_FN_TYPE)cleanup3); /* free objects */
lh_free(added);
added=NULL;
}