Commit 97b17195 authored by Geoff Thorpe's avatar Geoff Thorpe
Browse files

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.
parent b0dc680f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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;
			}
+10 −4
Original line number Diff line number Diff line
@@ -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
+10 −4
Original line number Diff line number Diff line
@@ -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);
+5 −2
Original line number Diff line number Diff line
@@ -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);
	}
+4 −1
Original line number Diff line number Diff line
@@ -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);
	}

Loading