o_names.c revision 9dc0df1bac950d6e491f9a7c7e4888f2b301cb15
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/safestack.h>
/* Later versions of DEC C has started to add lnkage information to certain
* functions, which makes it tricky to use them as values to regular function
* pointers. One way is to define a macro that takes care of casting them
* correctly.
*/
#ifdef OPENSSL_SYS_VMS_DECC
# define OPENSSL_strcmp (int (*)(const char *,const char *))strcmp
#else
# define OPENSSL_strcmp strcmp
#endif
/* I use the ex_data stuff to manage the identifiers for the obj_name_types
* that applications may define. I only really use the free function field.
*/
static int names_type_num=OBJ_NAME_TYPE_NUM;
typedef struct name_funcs_st
{
int (*cmp_func)(const char *a,const char *b);
void (*free_func)(const char *, int, const char *);
} NAME_FUNCS;
/* The LHASH callbacks now use the raw "void *" prototypes and do per-variable
* casting in the functions. This prevents function pointer casting without the
* need for macro-generated wrapper functions. */
/* static unsigned long obj_name_hash(OBJ_NAME *a); */
static unsigned long obj_name_hash(const void *a_void);
/* static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); */
int OBJ_NAME_init(void)
{
MemCheck_off();
MemCheck_on();
}
int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
int (*cmp_func)(const char *, const char *),
void (*free_func)(const char *, int, const char *))
{
int ret;
int i;
if (name_funcs_stack == NULL)
{
MemCheck_off();
MemCheck_on();
}
if ((name_funcs_stack == NULL))
{
/* ERROR */
return(0);
}
{
MemCheck_off();
MemCheck_on();
if (!name_funcs)
{
return(0);
}
* ((void *)0), which according
* to Compaq C is not really
* compatible with a function
* pointer. -- Richard Levitte*/
MemCheck_off();
MemCheck_on();
}
return(ret);
}
/* static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) */
{
int ret;
if (ret == 0)
{
if ((name_funcs_stack != NULL)
{
}
else
}
return(ret);
}
/* static unsigned long obj_name_hash(OBJ_NAME *a) */
static unsigned long obj_name_hash(const void *a_void)
{
unsigned long ret;
{
}
else
{
}
return(ret);
}
{
type&= ~OBJ_NAME_ALIAS;
for (;;)
{
{
}
else
{
}
}
}
{
int alias;
type&= ~OBJ_NAME_ALIAS;
{
/* ERROR */
return(0);
}
{
/* free things */
{
/* XXX: I'm not sure I understand why the free
* function should get three arguments...
* -- Richard Levitte
*/
}
}
else
{
{
/* ERROR */
return(0);
}
}
return(1);
}
{
type&= ~OBJ_NAME_ALIAS;
{
/* free things */
{
/* XXX: I'm not sure I understand why the free
* function should get three arguments...
* -- Richard Levitte
*/
}
return(1);
}
else
return(0);
}
struct doall
{
int type;
void *arg;
};
{
}
{
struct doall d;
}
struct doall_sorted
{
int type;
int n;
};
{
struct doall_sorted *d=d_;
return;
}
{
}
void *arg)
{
struct doall_sorted d;
int n;
d.n=0;
for(n=0 ; n < d.n ; ++n)
OPENSSL_free((void *)d.names);
}
static int free_type;
{
return;
{
}
}
{
}
void OBJ_NAME_cleanup(int type)
{
unsigned long down_load;
if (type < 0)
{
}
else
}