Further ANSI changes now builds and passes (most) tests
[p5sagit/p5-mst-13.2.git] / ext / SDBM_File / sdbm / sdbm.h
index 11967ec..fc0ea87 100644 (file)
@@ -120,7 +120,7 @@ extern long sdbm_hash proto((char *, int));
 #include <unistd.h>
 #endif
 
-#ifndef MSDOS
+#if !defined(MSDOS) && !defined(WIN32)
 #   ifdef PARAM_NEEDS_TYPES
 #      include <sys/types.h>
 #   endif
@@ -168,10 +168,10 @@ extern long sdbm_hash proto((char *, int));
 #      define free    Perl_free
 #   endif
 
-    Malloc_t malloc _((MEM_SIZE nbytes));
-    Malloc_t calloc _((MEM_SIZE elements, MEM_SIZE size));
-    Malloc_t realloc _((Malloc_t where, MEM_SIZE nbytes));
-    Free_t   free _((Malloc_t where));
+    Malloc_t malloc proto((MEM_SIZE nbytes));
+    Malloc_t calloc proto((MEM_SIZE elements, MEM_SIZE size));
+    Malloc_t realloc proto((Malloc_t where, MEM_SIZE nbytes));
+    Free_t   free proto((Malloc_t where));
 
 #endif /* MYMALLOC && (HIDEMYMALLOC || EMBEDMYMALLOC) */
 
@@ -183,16 +183,16 @@ extern long sdbm_hash proto((char *, int));
 
 #ifdef I_MEMORY
 #include <memory.h>
-#endif
+#endif      
 
-#if defined(mips) && defined(ultrix) && !defined(__STDC__)
-#   undef HAS_MEMCMP
+#ifdef __cplusplus
+#define HAS_MEMCPY
 #endif
 
 #ifdef HAS_MEMCPY
 #  if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
 #    ifndef memcpy
-        extern char * memcpy _((char*, char*, int));
+        extern char * memcpy proto((char*, char*, int));
 #    endif
 #  endif
 #else
@@ -208,7 +208,7 @@ extern long sdbm_hash proto((char *, int));
 #ifdef HAS_MEMSET
 #  if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
 #    ifndef memset
-       extern char *memset _((char*, int, int));
+       extern char *memset proto((char*, int, int));
 #    endif
 #  endif
 #  define memzero(d,l) memset(d,0,l)
@@ -222,24 +222,46 @@ extern long sdbm_hash proto((char *, int));
 #   endif
 #endif /* HAS_MEMSET */
 
-#ifdef HAS_MEMCMP
+#if defined(mips) && defined(ultrix) && !defined(__STDC__)
+#   undef HAS_MEMCMP
+#endif
+
+#if defined(HAS_MEMCMP) && defined(HAS_SANE_MEMCMP)
 #  if !defined(STANDARD_C) && !defined(I_STRING) && !defined(I_MEMORY)
 #    ifndef memcmp
-       extern int memcmp _((char*, char*, int));
+       extern int memcmp proto((char*, char*, int));
 #    endif
 #  endif
+#  ifdef BUGGY_MSC
+  #  pragma function(memcmp)
+#  endif
 #else
 #   ifndef memcmp
-#      define memcmp   my_memcmp
+#      /* maybe we should have included the full embedding header... */
+#      ifdef NO_EMBED
+#          define memcmp my_memcmp
+#      else
+#          define memcmp Perl_my_memcmp
+#      endif
+#ifndef __cplusplus
+       extern int memcmp proto((char*, char*, int));
+#endif
 #   endif
 #endif /* HAS_MEMCMP */
 
-/* we prefer bcmp slightly for comparisons that don't care about ordering */
 #ifndef HAS_BCMP
 #   ifndef bcmp
 #      define bcmp(s1,s2,l) memcmp(s1,s2,l)
 #   endif
-#endif /* HAS_BCMP */
+#endif /* !HAS_BCMP */
+
+#ifdef HAS_MEMCMP
+#  define memNE(s1,s2,l) (memcmp(s1,s2,l))
+#  define memEQ(s1,s2,l) (!memcmp(s1,s2,l))
+#else
+#  define memNE(s1,s2,l) (bcmp(s1,s2,l))
+#  define memEQ(s1,s2,l) (!bcmp(s1,s2,l))
+#endif
 
 #ifdef I_NETINET_IN
 #   include <netinet/in.h>