Commit 8d28d5f8 authored by Richard Levitte's avatar Richard Levitte
Browse files

Constification of the data of a hash table. This means the callback

functions need to be constified, and therefore meant a number of easy
changes a little everywhere.

Now, if someone could explain to me why OBJ_dup() cheats...
parent 53b407da
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -79,9 +79,9 @@
 * functions. */

/* static unsigned long MS_CALLBACK hash(FUNCTION *a); */
static unsigned long MS_CALLBACK hash(void *a_void);
static unsigned long MS_CALLBACK hash(const void *a_void);
/* static int MS_CALLBACK cmp(FUNCTION *a,FUNCTION *b); */
static int MS_CALLBACK cmp(void *a_void,void *b_void);
static int MS_CALLBACK cmp(const void *a_void,const void *b_void);
static LHASH *prog_init(void );
static int do_cmd(LHASH *prog,int argc,char *argv[]);
LHASH *config=NULL;
@@ -367,14 +367,14 @@ static LHASH *prog_init(void)
	}

/* static int MS_CALLBACK cmp(FUNCTION *a, FUNCTION *b) */
static int MS_CALLBACK cmp(void *a_void, void *b_void)
static int MS_CALLBACK cmp(const void *a_void, const void *b_void)
	{
	return(strncmp(((FUNCTION *)a_void)->name,
			((FUNCTION *)b_void)->name,8));
	}

/* static unsigned long MS_CALLBACK hash(FUNCTION *a) */
static unsigned long MS_CALLBACK hash(void *a_void)
static unsigned long MS_CALLBACK hash(const void *a_void)
	{
	return(lh_strhash(((FUNCTION *)a_void)->name));
	}
+1 −1
Original line number Diff line number Diff line
@@ -302,7 +302,7 @@ void ASN1_OBJECT_free(ASN1_OBJECT *a)
	}

ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
	     char *sn, char *ln)
	     const char *sn, const char *ln)
	{
	ASN1_OBJECT o;

+1 −1
Original line number Diff line number Diff line
@@ -758,7 +758,7 @@ int i2t_ASN1_OBJECT(char *buf,int buf_len,ASN1_OBJECT *a);

int a2d_ASN1_OBJECT(unsigned char *out,int olen, const char *buf, int num);
ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data,int len,
	char *sn, char *ln);
	const char *sn, const char *ln);

int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
long ASN1_INTEGER_get(ASN1_INTEGER *a);
+4 −4
Original line number Diff line number Diff line
@@ -73,9 +73,9 @@ static void value_free_stack(CONF_VALUE *a,LHASH *conf);
/* We don't use function pointer casting or wrapper functions - but cast each
 * callback parameter inside the callback functions. */
/* static unsigned long hash(CONF_VALUE *v); */
static unsigned long hash(void *v_void);
static unsigned long hash(const void *v_void);
/* static int cmp_conf(CONF_VALUE *a,CONF_VALUE *b); */
static int cmp_conf(void *a_void,void *b_void);
static int cmp_conf(const void *a_void,const void *b_void);

/* Up until OpenSSL 0.9.5a, this was get_section */
CONF_VALUE *_CONF_get_section(CONF *conf, char *section)
@@ -239,14 +239,14 @@ static void value_free_stack(CONF_VALUE *a, LHASH *conf)
	}

/* static unsigned long hash(CONF_VALUE *v) */
static unsigned long hash(void *v_void)
static unsigned long hash(const void *v_void)
	{
	CONF_VALUE *v = (CONF_VALUE *)v_void;
	return((lh_strhash(v->section)<<2)^lh_strhash(v->name));
	}

/* static int cmp_conf(CONF_VALUE *a, CONF_VALUE *b) */
static int cmp_conf(void *a_void, void *b_void)
static int cmp_conf(const void *a_void,const  void *b_void)
	{
	int i;
	CONF_VALUE *a = (CONF_VALUE *)a_void;
+8 −8
Original line number Diff line number Diff line
@@ -124,13 +124,13 @@ static LHASH *error_hash=NULL;
static LHASH *thread_hash=NULL;

/* static unsigned long err_hash(ERR_STRING_DATA *a); */
static unsigned long err_hash(void *a_void);
static unsigned long err_hash(const void *a_void);
/* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b); */
static int err_cmp(void *a_void, void *b_void);
static int err_cmp(const void *a_void, const void *b_void);
/* static unsigned long pid_hash(ERR_STATE *pid); */
static unsigned long pid_hash(void *pid_void);
static unsigned long pid_hash(const void *pid_void);
/* static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); */
static int pid_cmp(void *a_void,void *pid_void);
static int pid_cmp(const void *a_void,const void *pid_void);
static unsigned long get_error_values(int inc,const char **file,int *line,
				      const char **data,int *flags);

@@ -626,7 +626,7 @@ const char *ERR_reason_error_string(unsigned long e)
	}

/* static unsigned long err_hash(ERR_STRING_DATA *a) */
static unsigned long err_hash(void *a_void)
static unsigned long err_hash(const void *a_void)
	{
	unsigned long ret,l;

@@ -636,20 +636,20 @@ static unsigned long err_hash(void *a_void)
	}

/* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b) */
static int err_cmp(void *a_void, void *b_void)
static int err_cmp(const void *a_void, const void *b_void)
	{
	return((int)(((ERR_STRING_DATA *)a_void)->error -
			((ERR_STRING_DATA *)b_void)->error));
	}

/* static unsigned long pid_hash(ERR_STATE *a) */
static unsigned long pid_hash(void *a_void)
static unsigned long pid_hash(const void *a_void)
	{
	return(((ERR_STATE *)a_void)->pid*13);
	}

/* static int pid_cmp(ERR_STATE *a, ERR_STATE *b) */
static int pid_cmp(void *a_void, void *b_void)
static int pid_cmp(const void *a_void, const void *b_void)
	{
	return((int)((long)((ERR_STATE *)a_void)->pid -
			(long)((ERR_STATE *)b_void)->pid));
Loading