]> granicus.if.org Git - graphviz/commitdiff
Remove definition and usage of HAVE_STRERROR
authorErwin Janssen <erwinjanssen@outlook.com>
Wed, 28 Dec 2016 18:19:02 +0000 (19:19 +0100)
committerErwin Janssen <erwinjanssen@outlook.com>
Wed, 4 Jan 2017 23:30:14 +0000 (00:30 +0100)
This function is part of the standard C library, checking is therefore not
needed. With this change, check that sets HAVE_ERRNO_DECLS and the file
lib/ast/strerror.c can both be removed.

cmd/lefty/ws/x11/libfilereq/SelFile.c
config.iffe
configure.ac
lib/ast/Makefile.am
lib/ast/ast.vcxproj
lib/ast/ast.vcxproj.filters
lib/ast/strerror.c [deleted file]
windows/include/config.h

index ccb1a8fb0827ed4b23d5dcbfae9cdadc4d0dba95..3b596fb14d67c12a70b04089416655262a2ee562 100644 (file)
 #include <stdio.h>
 #include <errno.h>
 
-#ifndef HAVE_STRERROR
-#  ifndef HAVE_ERRNO_DECL
-extern int errno;
-extern int sys_nerr;
-#    if (linux)
-extern const char *const sys_errlist[];
-#    else
-extern char *sys_errlist[];
-#    endif
-#  endif
-#endif
-
 #include <sys/param.h>
 #include <X11/cursorfont.h>
 #include <X11/Intrinsic.h>
@@ -609,7 +597,6 @@ FILE *SFopenFile (char *name, char *mode, char *prompt, char *failed) {
     SFchdir (SFstartDir);
     if ((fp = fopen (name, mode)) == NULL) {
         char *buf;
-#ifdef HAVE_STRERROR
         char *errormsg = strerror (errno);
         if (errormsg) {
             buf = XtMalloc (
@@ -618,17 +605,6 @@ FILE *SFopenFile (char *name, char *mode, char *prompt, char *failed) {
             strcpy (buf, failed);
             strcat (buf, errormsg);
             strcat (buf, "\n");
-#else
-        if (errno < sys_nerr) {
-            buf = XtMalloc (
-                strlen (failed) + strlen (sys_errlist[errno]) +
-                strlen (prompt) + 2
-            );
-            strcpy (buf, failed);
-            strcat (buf, sys_errlist[errno]);
-            strcat (buf, "\n");
-            strcat (buf, prompt);
-#endif
         } else {
             buf = XtMalloc (strlen (failed) + strlen (prompt) + 2);
             strcpy (buf, failed);
index 37aa13abf94887798d0b85a10d66cd90af0862f5..f898977c0aaed2b15f7bcc27c6092aec7ca5b912 100644 (file)
@@ -19,7 +19,6 @@ lib srand48
 lib sincos
 lib strcasecmp
 lib strncasecmp
-lib strerror
 
 hdr dirent
 hdr dlfcn
@@ -48,11 +47,6 @@ sys fpu
 sys ndir
 cat{ }end
 
-dat errno stdio.h errno.h yes{
-/* Define if errno is declared in system include files.  */
-#define HAVE_ERRNO_DECL 1
-}end
-
 #  Specify internal structure of FILE.
 #  This is used to determine if more characters are waiting in the stream.
 if mem - FILE._cnt stdio.h {
index f832d9df69efa08b9af60149c73c18fa82371c97..dc11bb18841198b65ddaef2e579aea0f19e84c89 100644 (file)
@@ -461,7 +461,7 @@ AC_SUBST([LIBGEN_LIBS])
 
 # Checks for library functions
 AC_CHECK_FUNCS([lrand48 drand48 srand48 setmode setenv getenv \
-       strerror cbrt vsnprintf _NSGetEnviron])
+       cbrt vsnprintf _NSGetEnviron])
 
 AC_REPLACE_FUNCS([strcasecmp strncasecmp strcasestr])
 
@@ -3024,17 +3024,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
 
 # -----------------------------------
 
-AC_MSG_CHECKING(if errno externs are declared)
-AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
-       #include <errno.h>
-       ]], [[if ( errno < sys_nerr ) return sys_errlist[errno];
-       ]])],[AC_MSG_RESULT(yes)
-       AC_DEFINE_UNQUOTED(HAVE_ERRNO_DECL,1,Define if errno externs are declared)
-       ],[AC_MSG_RESULT(no)
-       ])
-
-# -----------------------------------
-
 AC_MSG_CHECKING(if intptr_t is declared)
 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
   #include <stdint.h>
index 8c0032d6314d00176a7f164a7104a14aae7ed897..695aacc7f62057621f7fd03c07f8814a8f6ab138 100644 (file)
@@ -9,6 +9,6 @@ noinst_LTLIBRARIES = libast_C.la
 libast_C_la_SOURCES = pathpath.c sfstr.h chresc.c chrtoi.c error.c \
        fmtbuf.c fmtesc.c pathaccess.c pathbin.c pathcanon.c pathcat.c \
        pathexists.c pathfind.c pathgetlink.c \
-       strcopy.c stresc.c strmatch.c strton.c strerror.c
+       strcopy.c stresc.c strmatch.c strton.c
 
 EXTRA_DIST = compat_unistd.h ast.vcxproj*
index 8763ac1a5cca03652b8820387ae5f6fa6898deef..ff63959677b46319e7e755908999e56ee57a4047 100644 (file)
@@ -99,7 +99,6 @@
     <ClCompile Include="pathgetlink.c" />
     <ClCompile Include="pathpath.c" />
     <ClCompile Include="strcopy.c" />
-    <ClCompile Include="strerror.c" />
     <ClCompile Include="stresc.c" />
     <ClCompile Include="strmatch.c" />
     <ClCompile Include="strton.c" />
index 6097b0f1ea55bcf45c4d8f3a5f2c888f7b9f0963..2a5f8922f4f8ec60c917756cab46b11666c707ab 100644 (file)
@@ -77,9 +77,6 @@
     <ClCompile Include="strcopy.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="strerror.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="stresc.c">
       <Filter>Source Files</Filter>
     </ClCompile>
diff --git a/lib/ast/strerror.c b/lib/ast/strerror.c
deleted file mode 100644 (file)
index ecbe593..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/* $Id$ $Revision$ */
-/* vim:set shiftwidth=4 ts=8: */
-
-/*************************************************************************
- * Copyright (c) 2011 AT&T Intellectual Property 
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors: See CVS logs. Details at http://www.graphviz.org/
- *************************************************************************/
-
-
-#include "config.h"
-#ifndef HAVE_STRERROR
-#include <errno.h>
-
-extern int sys_nerr;
-extern char *sys_errlist[];
-
-char *strerror(int errorNumber)
-{
-    if (errorNumber > 0 && errorNumber < sys_nerr) {
-       return sys_errlist[errorNumber];
-    } else {
-       return "";
-    }
-}
-#endif
index d3a26f873e282395aa5b8d8c2c0905e035229c4e..00d9b7a3d8130989ab16b2cb05dba48a009fb504 100644 (file)
@@ -56,9 +56,6 @@
 /* Define to 1 if you have the `drand48' function. */
 /* #undef HAVE_DRAND48 */
 
-/* Define if errno externs are declared */
-/* #undef HAVE_ERRNO_DECL */
-
 /* Define if you have the expat library */
 #define HAVE_EXPAT 1
 
 /* Define to 1 if you have the `strcasecmp' function. */
 //#define HAVE_STRCASECMP 1
 
-/* Define to 1 if you have the `strerror' function. */
-#define HAVE_STRERROR 1
-
 /* Define to 1 if you have the <strings.h> header file. */
 //#define HAVE_STRINGS_H 1