Use -mcpu on alpha.
[oweals/openssl.git] / crypto / objects / o_names.c
index 5e70508d9a09f3bb051b822e64c650d342477555..adb5731f7659f52e3c0de19af53a26e4fee4bb4e 100644 (file)
@@ -2,9 +2,22 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include <openssl/err.h>
 #include <openssl/lhash.h>
 #include <openssl/objects.h>
 #include <openssl/safestack.h>
+#include <openssl/e_os2.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.
@@ -67,13 +80,20 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
                {
                MemCheck_off();
                name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
+               MemCheck_on();
+               if (!name_funcs)
+                       {
+                       OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX,ERR_R_MALLOC_FAILURE);
+                       return(0);
+                       }
                name_funcs->hash_func = lh_strhash;
-               name_funcs->cmp_func = strcmp;
+               name_funcs->cmp_func = OPENSSL_strcmp;
                name_funcs->free_func = 0; /* NULL is often declared to
                                                * ((void *)0), which according
                                                * to Compaq C is not really
                                                * compatible with a function
                                                * pointer.      -- Richard Levitte*/
+               MemCheck_off();
                sk_NAME_FUNCS_push(name_funcs_stack,name_funcs);
                MemCheck_on();
                }
@@ -91,8 +111,8 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
 static int obj_name_cmp(const void *a_void, const void *b_void)
        {
        int ret;
-       OBJ_NAME *a = (OBJ_NAME *)a_void;
-       OBJ_NAME *b = (OBJ_NAME *)b_void;
+       const OBJ_NAME *a = (const OBJ_NAME *)a_void;
+       const OBJ_NAME *b = (const OBJ_NAME *)b_void;
 
        ret=a->type-b->type;
        if (ret == 0)
@@ -113,7 +133,7 @@ static int obj_name_cmp(const void *a_void, const void *b_void)
 static unsigned long obj_name_hash(const void *a_void)
        {
        unsigned long ret;
-       OBJ_NAME *a = (OBJ_NAME *)a_void;
+       const OBJ_NAME *a = (const OBJ_NAME *)a_void;
 
        if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type))
                {