OSDN Git Service

* jcf-write.c (generate_bytecode_insns) [SWITCH_EXPR]: Call
[pf3gnuchains/gcc-fork.git] / libiberty / strerror.c
index f5e2eeb..ba837e3 100644 (file)
@@ -7,32 +7,37 @@
 
 #include "config.h"
 
-#ifndef NEED_sys_errlist
+#ifdef HAVE_SYS_ERRLIST
 /* Note that errno.h (not sure what OS) or stdio.h (BSD 4.4, at least)
    might declare sys_errlist in a way that the compiler might consider
    incompatible with our later declaration, perhaps by using const
    attributes.  So we hide the declaration in errno.h (if any) using a
    macro. */
+#define sys_nerr sys_nerr__
 #define sys_errlist sys_errlist__
 #endif
 
 #include <stdio.h>
 #include <errno.h>
 
-#ifndef NEED_sys_errlist
+#ifdef HAVE_SYS_ERRLIST
+#undef sys_nerr
 #undef sys_errlist
 #endif
 
 /*  Routines imported from standard C runtime libraries. */
 
-#ifdef __STDC__
-#include <stddef.h>
-extern void *malloc (size_t size);                             /* 4.10.3.3 */
-extern void *memset (void *s, int c, size_t n);                        /* 4.11.6.1 */
-#else  /* !__STDC__ */
-extern char *malloc ();                /* Standard memory allocater */
-extern char *memset ();
-#endif /* __STDC__ */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+extern PTR malloc ();
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#else
+extern PTR memset ();
+#endif
 
 #ifndef MAX
 #  define MAX(a,b) ((a) > (b) ? (a) : (b))
@@ -55,12 +60,12 @@ struct error_info
 {
   int value;           /* The numeric value from <errno.h> */
   const char *name;    /* The equivalent symbolic value */
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
   const char *msg;     /* Short message about this value */
 #endif
 };
 
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
 #   define ENTRY(value, name, msg)     {value, name, msg}
 #else
 #   define ENTRY(value, name, msg)     {value, name}
@@ -455,7 +460,7 @@ static int num_error_names = 0;
    same name, it differs from other implementations in that it is dynamically
    initialized rather than statically initialized. */
 
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
 
 static int sys_nerr;
 static const char **sys_errlist;
@@ -532,7 +537,7 @@ init_error_tables ()
        }
     }
 
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
 
   /* Now attempt to allocate the sys_errlist table, zero it out, and then
      initialize it from the statically initialized error_table. */
@@ -595,7 +600,7 @@ errno_max ()
   return (maxsize - 1);
 }
 
-#ifdef NEED_strerror
+#ifndef HAVE_STRERROR
 
 /*
 
@@ -634,7 +639,7 @@ strerror (errnoval)
   char *msg;
   static char buf[32];
 
-#ifdef NEED_sys_errlist
+#ifndef HAVE_SYS_ERRLIST
 
   if (error_names == NULL)
     {
@@ -668,7 +673,7 @@ strerror (errnoval)
   return (msg);
 }
 
-#endif /* NEED_strerror */
+#endif /* ! HAVE_STRERROR */
 
 
 /*