From bdc70135e6fc37666f9f74e4653b7cef576e542c Mon Sep 17 00:00:00 2001 From: Erwin Janssen Date: Wed, 28 Dec 2016 19:19:02 +0100 Subject: [PATCH] Remove definition and usage of HAVE_STRERROR 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 | 24 --------------------- config.iffe | 6 ------ configure.ac | 13 +----------- lib/ast/Makefile.am | 2 +- lib/ast/ast.vcxproj | 1 - lib/ast/ast.vcxproj.filters | 3 --- lib/ast/strerror.c | 30 --------------------------- windows/include/config.h | 6 ------ 8 files changed, 2 insertions(+), 83 deletions(-) delete mode 100644 lib/ast/strerror.c diff --git a/cmd/lefty/ws/x11/libfilereq/SelFile.c b/cmd/lefty/ws/x11/libfilereq/SelFile.c index ccb1a8fb0..3b596fb14 100644 --- a/cmd/lefty/ws/x11/libfilereq/SelFile.c +++ b/cmd/lefty/ws/x11/libfilereq/SelFile.c @@ -62,18 +62,6 @@ #include #include -#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 #include #include @@ -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); diff --git a/config.iffe b/config.iffe index 37aa13abf..f898977c0 100644 --- a/config.iffe +++ b/config.iffe @@ -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 { diff --git a/configure.ac b/configure.ac index f832d9df6..dc11bb188 100644 --- a/configure.ac +++ b/configure.ac @@ -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 # ----------------------------------- -AC_MSG_CHECKING(if errno externs are declared) -AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include - #include - ]], [[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 #include diff --git a/lib/ast/Makefile.am b/lib/ast/Makefile.am index 8c0032d63..695aacc7f 100644 --- a/lib/ast/Makefile.am +++ b/lib/ast/Makefile.am @@ -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* diff --git a/lib/ast/ast.vcxproj b/lib/ast/ast.vcxproj index 8763ac1a5..ff6395967 100644 --- a/lib/ast/ast.vcxproj +++ b/lib/ast/ast.vcxproj @@ -99,7 +99,6 @@ - diff --git a/lib/ast/ast.vcxproj.filters b/lib/ast/ast.vcxproj.filters index 6097b0f1e..2a5f8922f 100644 --- a/lib/ast/ast.vcxproj.filters +++ b/lib/ast/ast.vcxproj.filters @@ -77,9 +77,6 @@ Source Files - - Source Files - Source Files diff --git a/lib/ast/strerror.c b/lib/ast/strerror.c deleted file mode 100644 index ecbe593ab..000000000 --- a/lib/ast/strerror.c +++ /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 - -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 diff --git a/windows/include/config.h b/windows/include/config.h index d3a26f873..00d9b7a3d 100644 --- a/windows/include/config.h +++ b/windows/include/config.h @@ -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 @@ -228,9 +225,6 @@ /* 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 header file. */ //#define HAVE_STRINGS_H 1 -- 2.40.0