* 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;
}
/* 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));
}
}
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;
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);
/* 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)
}
/* 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;
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);
}
/* 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;
}
/* 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));
static void expand(LHASH *lh);
static void contract(LHASH *lh);
-static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash);
+static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhash);
LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
{
OPENSSL_free(lh);
}
-void *lh_insert(LHASH *lh, void *data)
+void *lh_insert(LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
- void *ret;
+ const void *ret;
lh->error=0;
if (lh->up_load <= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))
(*rn)->data=data;
lh->num_replace++;
}
- return(ret);
+ return((void *)ret);
}
-void *lh_delete(LHASH *lh, void *data)
+void *lh_delete(LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
- void *ret;
+ const void *ret;
lh->error=0;
rn=getrn(lh,data,&hash);
(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
contract(lh);
- return(ret);
+ return((void *)ret);
}
-void *lh_retrieve(LHASH *lh, void *data)
+void *lh_retrieve(LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE **rn;
- void *ret;
+ const void *ret;
lh->error=0;
rn=getrn(lh,data,&hash);
ret= (*rn)->data;
lh->num_retrieve++;
}
- return(ret);
+ return((void *)ret);
}
void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func)
lh_doall_arg(lh, (LHASH_DOALL_ARG_FN_TYPE)func, NULL);
}
-void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
+void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, const void *arg)
{
int i;
LHASH_NODE *a,*n;
}
}
-static LHASH_NODE **getrn(LHASH *lh, void *data, unsigned long *rhash)
+static LHASH_NODE **getrn(LHASH *lh, const void *data, unsigned long *rhash)
{
LHASH_NODE **ret,*n1;
unsigned long hash,nn;
typedef struct lhash_node_st
{
- void *data;
+ const void *data;
struct lhash_node_st *next;
#ifndef NO_HASH_COMP
unsigned long hash;
#endif
} LHASH_NODE;
-typedef int (*LHASH_COMP_FN_TYPE)(void *, void *);
-typedef unsigned long (*LHASH_HASH_FN_TYPE)(void *);
-typedef void (*LHASH_DOALL_FN_TYPE)(void *);
-typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *);
+typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
+typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
+typedef void (*LHASH_DOALL_FN_TYPE)(const void *);
+typedef void (*LHASH_DOALL_ARG_FN_TYPE)(const void *, const void *);
/* Macros for declaring and implementing type-safe wrappers for LHASH callbacks.
* This way, callbacks can be provided to LHASH structures without function
/* First: "hash" functions */
#define DECLARE_LHASH_HASH_FN(f_name,o_type) \
- unsigned long f_name##_LHASH_HASH(void *);
+ unsigned long f_name##_LHASH_HASH(const void *);
#define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \
- unsigned long f_name##_LHASH_HASH(void *arg) { \
+ unsigned long f_name##_LHASH_HASH(const void *arg) { \
o_type a = (o_type)arg; \
return f_name(a); }
#define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH
/* Second: "compare" functions */
#define DECLARE_LHASH_COMP_FN(f_name,o_type) \
- int f_name##_LHASH_COMP(void *, void *);
+ int f_name##_LHASH_COMP(const void *, const void *);
#define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \
- int f_name##_LHASH_COMP(void *arg1, void *arg2) { \
+ int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \
o_type a = (o_type)arg1; \
o_type b = (o_type)arg2; \
return f_name(a,b); }
LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
void lh_free(LHASH *lh);
-void *lh_insert(LHASH *lh, void *data);
-void *lh_delete(LHASH *lh, void *data);
-void *lh_retrieve(LHASH *lh, void *data);
+void *lh_insert(LHASH *lh, const void *data);
+void *lh_delete(LHASH *lh, const void *data);
+void *lh_retrieve(LHASH *lh, const void *data);
void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func);
-void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);
+void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, const void *arg);
unsigned long lh_strhash(const char *c);
unsigned long lh_num_items(const LHASH *lh);
malloc_debug_func(NULL, num, file, line, 0);
}
ret = malloc_locked_func(num);
-#ifdef LEVITTE_DEBUG
- fprintf(stderr, "LEVITTE_DEBUG: > 0x%p (%d)\n", ret, num);
+#ifdef LEVITTE_DEBUG_MEM
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
#endif
if (malloc_debug_func != NULL)
malloc_debug_func(ret, num, file, line, 1);
{
if (free_debug_func != NULL)
free_debug_func(str, 0);
-#ifdef LEVITTE_DEBUG
- fprintf(stderr, "LEVITTE_DEBUG: < 0x%p\n", str);
+#ifdef LEVITTE_DEBUG_MEM
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
#endif
free_locked_func(str);
if (free_debug_func != NULL)
malloc_debug_func(NULL, num, file, line, 0);
}
ret = malloc_func(num);
-#ifdef LEVITTE_DEBUG
- fprintf(stderr, "LEVITTE_DEBUG: > 0x%p (%d)\n", ret, num);
+#ifdef LEVITTE_DEBUG_MEM
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
#endif
if (malloc_debug_func != NULL)
malloc_debug_func(ret, num, file, line, 1);
if (realloc_debug_func != NULL)
realloc_debug_func(str, NULL, num, file, line, 0);
ret = realloc_func(str,num);
-#ifdef LEVITTE_DEBUG
- fprintf(stderr, "LEVITTE_DEBUG: | 0x%p -> 0x%p (%d)\n", str, ret, num);
+#ifdef LEVITTE_DEBUG_MEM
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: | 0x%p -> 0x%p (%d)\n", str, ret, num);
#endif
if (realloc_debug_func != NULL)
realloc_debug_func(str, ret, num, file, line, 1);
{
if (free_debug_func != NULL)
free_debug_func(str, 0);
-#ifdef LEVITTE_DEBUG
- fprintf(stderr, "LEVITTE_DEBUG: < 0x%p\n", str);
+#ifdef LEVITTE_DEBUG_MEM
+ fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
#endif
free_func(str);
if (free_debug_func != NULL)
}
/* static int mem_cmp(MEM *a, MEM *b) */
-static int mem_cmp(void *a_void, void *b_void)
+static int mem_cmp(const void *a_void, const void *b_void)
{
- return((char *)((MEM *)a_void)->addr - (char *)((MEM *)b_void)->addr);
+ return((const char *)((MEM *)a_void)->addr
+ - (const char *)((MEM *)b_void)->addr);
}
/* static unsigned long mem_hash(MEM *a) */
-static unsigned long mem_hash(void *a_void)
+static unsigned long mem_hash(const void *a_void)
{
unsigned long ret;
- ret=(unsigned long)((MEM *)a_void)->addr;
+ ret=(unsigned long)((const MEM *)a_void)->addr;
ret=ret*17851+(ret>>14)*7+(ret>>4)*251;
return(ret);
}
/* static int app_info_cmp(APP_INFO *a, APP_INFO *b) */
-static int app_info_cmp(void *a_void, void *b_void)
+static int app_info_cmp(const void *a_void, const void *b_void)
{
- return(((APP_INFO *)a_void)->thread != ((APP_INFO *)b_void)->thread);
+ return(((const APP_INFO *)a_void)->thread
+ != ((const APP_INFO *)b_void)->thread);
}
/* static unsigned long app_info_hash(APP_INFO *a) */
-static unsigned long app_info_hash(void *a_void)
+static unsigned long app_info_hash(const void *a_void)
{
unsigned long ret;
- ret=(unsigned long)((APP_INFO *)a_void)->thread;
+ ret=(unsigned long)((const APP_INFO *)a_void)->thread;
ret=ret*17851+(ret>>14)*7+(ret>>4)*251;
return(ret);
* need for macro-generated wrapper functions. */
/* static unsigned long obj_name_hash(OBJ_NAME *a); */
-static unsigned long obj_name_hash(void *a_void);
+static unsigned long obj_name_hash(const void *a_void);
/* static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); */
-static int obj_name_cmp(void *a_void,void *b_void);
+static int obj_name_cmp(const void *a_void,const void *b_void);
int OBJ_NAME_init(void)
{
}
/* static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) */
-static int obj_name_cmp(void *a_void, void *b_void)
+static int obj_name_cmp(const void *a_void, const void *b_void)
{
int ret;
OBJ_NAME *a = (OBJ_NAME *)a_void;
}
/* static unsigned long obj_name_hash(OBJ_NAME *a) */
-static unsigned long obj_name_hash(void *a_void)
+static unsigned long obj_name_hash(const void *a_void)
{
unsigned long ret;
OBJ_NAME *a = (OBJ_NAME *)a_void;
}
/* static unsigned long add_hash(ADDED_OBJ *ca) */
-static unsigned long add_hash(void *ca_void)
+static unsigned long add_hash(const void *ca_void)
{
- ASN1_OBJECT *a;
+ const ASN1_OBJECT *a;
int i;
unsigned long ret=0;
unsigned char *p;
}
/* static int add_cmp(ADDED_OBJ *ca, ADDED_OBJ *cb) */
-static int add_cmp(void *ca_void, void *cb_void)
+static int add_cmp(const void *ca_void, const void *cb_void)
{
ASN1_OBJECT *a,*b;
int i;
return(i);
}
-int OBJ_add_object(ASN1_OBJECT *obj)
+int OBJ_add_object(const ASN1_OBJECT *obj)
{
ASN1_OBJECT *o;
ADDED_OBJ *ao[4]={NULL,NULL,NULL,NULL},*aop;
}
}
-int OBJ_obj2nid(ASN1_OBJECT *a)
+int OBJ_obj2nid(const ASN1_OBJECT *a)
{
ASN1_OBJECT **op;
ADDED_OBJ ad,*adp;
if (added != NULL)
{
ad.type=ADDED_DATA;
- ad.obj=a;
+ ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
if (adp != NULL) return (adp->obj->nid);
}
return op;
}
-int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name)
+int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
{
int i,idx=0,n=0,len,nid;
unsigned long l;
return(n);
}
-int OBJ_txt2nid(char *s)
+int OBJ_txt2nid(const char *s)
{
ASN1_OBJECT *obj;
int nid;
return(memcmp(a->data,b->data,a->length));
}
-char *OBJ_bsearch(char *key, char *base, int num, int size, int (*cmp)(const void *, const void *))
+const char *OBJ_bsearch(const char *key, const char *base, int num, int size,
+ int (*cmp)(const void *, const void *))
{
int l,h,i,c;
- char *p;
+ const char *p;
if (num == 0) return(NULL);
l=0;
/* return(num); */
}
-int OBJ_create(char *oid, char *sn, char *ln)
+int OBJ_create(const char *oid, const char *sn, const char *ln)
{
int ok=0;
ASN1_OBJECT *op=NULL;
#include <openssl/objects.h>
#include <openssl/buffer.h>
-ASN1_OBJECT *OBJ_dup(ASN1_OBJECT *o)
+ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)
{
ASN1_OBJECT *r;
int i;
if (o == NULL) return(NULL);
if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
- return(o);
+ return((ASN1_OBJECT *)o); /* XXX: ugh! Why? What kind of
+ duplication is this??? */
r=ASN1_OBJECT_new();
if (r == NULL)
return(NULL);
}
-int OBJ_cmp(ASN1_OBJECT *a, ASN1_OBJECT *b)
+int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b)
{
int ret;
void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg),
void *arg);
-ASN1_OBJECT * OBJ_dup(ASN1_OBJECT *o);
+ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o);
ASN1_OBJECT * OBJ_nid2obj(int n);
const char * OBJ_nid2ln(int n);
const char * OBJ_nid2sn(int n);
-int OBJ_obj2nid(ASN1_OBJECT *o);
+int OBJ_obj2nid(const ASN1_OBJECT *o);
ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name);
-int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name);
-int OBJ_txt2nid(char *s);
+int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
+int OBJ_txt2nid(const char *s);
int OBJ_ln2nid(const char *s);
int OBJ_sn2nid(const char *s);
-int OBJ_cmp(ASN1_OBJECT *a,ASN1_OBJECT *b);
-char * OBJ_bsearch(char *key,char *base,int num,int size,int (*cmp)(const void *, const void *));
+int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);
+const char * OBJ_bsearch(const char *key,const char *base,int num,int size,
+ int (*cmp)(const void *, const void *));
void ERR_load_OBJ_strings(void );
int OBJ_new_nid(int num);
-int OBJ_add_object(ASN1_OBJECT *obj);
-int OBJ_create(char *oid,char *sn,char *ln);
+int OBJ_add_object(const ASN1_OBJECT *obj);
+int OBJ_create(const char *oid,const char *sn,const char *ln);
void OBJ_cleanup(void );
int OBJ_create_objects(BIO *in);