ret=(ERR_STATE *)lh_retrieve(thread_hash,(char *)&tmp);
ret=(ERR_STATE *)lh_retrieve(thread_hash,&tmp);
ERR_STATE *ERR_get_state(void)	{	static ERR_STATE fallback;	ERR_STATE *ret=NULL,tmp,*tmpp;	int i;	unsigned long pid;	pid=(unsigned long)CRYPTO_thread_id();	CRYPTO_r_lock(CRYPTO_LOCK_ERR);	if (thread_hash == NULL)		{		CRYPTO_r_unlock(CRYPTO_LOCK_ERR);		CRYPTO_w_lock(CRYPTO_LOCK_ERR);		if (thread_hash == NULL)			{			MemCheck_off();			thread_hash=lh_new(pid_hash,pid_cmp);			MemCheck_on();			CRYPTO_w_unlock(CRYPTO_LOCK_ERR);			if (thread_hash == NULL) return(&fallback);			}		else			CRYPTO_w_unlock(CRYPTO_LOCK_ERR);		}	else		{		tmp.pid=pid;		ret=(ERR_STATE *)lh_retrieve(thread_hash,(char *)&tmp);		CRYPTO_r_unlock(CRYPTO_LOCK_ERR);		}	/* ret == the error state, if NULL, make a new one */	if (ret == NULL)		{		ret=(ERR_STATE *)Malloc(sizeof(ERR_STATE));		if (ret == NULL) return(&fallback);		ret->pid=pid;		ret->top=0;		ret->bottom=0;		for (i=0; i<ERR_NUM_ERRORS; i++)			{			ret->err_data[i]=NULL;			ret->err_data_flags[i]=0;			}		CRYPTO_w_lock(CRYPTO_LOCK_ERR);		tmpp=(ERR_STATE *)lh_insert(thread_hash,(char *)ret);		CRYPTO_w_unlock(CRYPTO_LOCK_ERR);		if (tmpp != NULL) /* old entry - should not happen */			{			ERR_STATE_free(tmpp);			}		}	return(ret);	}