The callbacks in the NAME_FUNCS structure are not used directly as LHASH

callbacks, and their prototypes were consistent as they were. These casts
need reversing.

Also, I personally find line breaks during parameter lists (ie a line
ending in a comma) easier to read at a glance than line breaks at the end
of a function call and before a dereference on the return value (ie a line
ending in a closed-bracket followed by a line starting with "->").
This commit is contained in:
Geoff Thorpe 2001-02-20 16:31:15 +00:00
parent 48f2ef8d00
commit 4dc719fc37

View File

@ -67,8 +67,8 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
{ {
MemCheck_off(); MemCheck_off();
name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS)); name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
name_funcs->hash_func = (LHASH_HASH_FN_TYPE)lh_strhash; name_funcs->hash_func = lh_strhash;
name_funcs->cmp_func = (LHASH_COMP_FN_TYPE)strcmp; name_funcs->cmp_func = strcmp;
name_funcs->free_func = 0; /* NULL is often declared to name_funcs->free_func = 0; /* NULL is often declared to
* ((void *)0), which according * ((void *)0), which according
* to Compaq C is not really * to Compaq C is not really
@ -100,8 +100,8 @@ static int obj_name_cmp(const void *a_void, const void *b_void)
if ((name_funcs_stack != NULL) if ((name_funcs_stack != NULL)
&& (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type))
{ {
ret=sk_NAME_FUNCS_value(name_funcs_stack,a->type) ret=sk_NAME_FUNCS_value(name_funcs_stack,
->cmp_func(a->name,b->name); a->type)->cmp_func(a->name,b->name);
} }
else else
ret=strcmp(a->name,b->name); ret=strcmp(a->name,b->name);
@ -117,8 +117,8 @@ static unsigned long obj_name_hash(const void *a_void)
if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type))
{ {
ret=sk_NAME_FUNCS_value(name_funcs_stack,a->type) ret=sk_NAME_FUNCS_value(name_funcs_stack,
->hash_func(a->name); a->type)->hash_func(a->name);
} }
else else
{ {
@ -190,8 +190,8 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
* function should get three arguments... * function should get three arguments...
* -- Richard Levitte * -- Richard Levitte
*/ */
sk_NAME_FUNCS_value(name_funcs_stack,ret->type) sk_NAME_FUNCS_value(name_funcs_stack,
->free_func(ret->name,ret->type,ret->data); ret->type)->free_func(ret->name,ret->type,ret->data);
} }
OPENSSL_free(ret); OPENSSL_free(ret);
} }
@ -225,8 +225,8 @@ int OBJ_NAME_remove(const char *name, int type)
* function should get three arguments... * function should get three arguments...
* -- Richard Levitte * -- Richard Levitte
*/ */
sk_NAME_FUNCS_value(name_funcs_stack,ret->type) sk_NAME_FUNCS_value(name_funcs_stack,
->free_func(ret->name,ret->type,ret->data); ret->type)->free_func(ret->name,ret->type,ret->data);
} }
OPENSSL_free(ret); OPENSSL_free(ret);
return(1); return(1);