Remove HAVE_ERRNO_H

The `<errno.h>` header file is part of the standard C89 headers [1] and
on older systems there needed to be also a manual check if header is
present.

Since libgd requires at least C89 or greater, the `HAVE_ERRNO_H`
symbol defined by Autoconf in configure.ac [2], and Cmake build system
files can be removed and simplifed.

Refs:
[1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.3
[2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
master
Peter Kokot 2018-09-05 01:02:44 +02:00 committed by Mike Frysinger
parent 96d68e3614
commit 1e7f93922f
8 changed files with 6 additions and 22 deletions

View File

@ -857,11 +857,6 @@ $COPY SYS$INPUT [.SRC]CONFIG.H
/* Define to 1 if you have the <dlfcn.h> header file. */
#define HAVE_DLFCN_H 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1

View File

@ -1,7 +1,6 @@
# Keep in sync with AC_CHECK_HEADERS in configure.ac.
check_include_files(dirent.h HAVE_DIRENT_H)
check_include_files(errno.h HAVE_ERRNO_H)
check_include_files(inttypes.h HAVE_INTTYPES_H)
check_include_files(limits.h HAVE_LIMITS_H)
check_include_files(stddef.h HAVE_STDDEF_H)

View File

@ -60,7 +60,6 @@ dnl Keep in sync with cmake/modules/AC_HEADER_STDC.cmake.
AC_HEADER_STDC
AC_CHECK_HEADERS_ONCE(m4_flatten([
dirent.h
errno.h
inttypes.h
limits.h
stddef.h

View File

@ -24,7 +24,7 @@ SJIS encoding のフォントが使用できます。
漢字コードの変換に OS 付属の iconv() を使う場合は
CFLAGS に -DHAVE_ICONV を付けてコンパイルしてください。
この場合に -DHAVE_STDARG_H と -DHAVE_ERRNO_H も付けておくと
この場合に -DHAVE_STDARG_H と も付けておくと
漢字コード変換の際にエラーが発生した場合に適切なメッセージを
表示するようになります。

View File

@ -12,9 +12,6 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H
/* Define if you have the ft2build.h header. */
#cmakedefine HAVE_FT2BUILD_H

View File

@ -11,11 +11,7 @@
#include "gd.h"
#include "gdhelpers.h"
#include "gd_errors.h"
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <stdarg.h>
#if defined(HAVE_ICONV_H)
#include <iconv.h>
@ -344,10 +340,10 @@ do_convert (unsigned char **to_p, const unsigned char **from_p, const char *code
if ((cd = iconv_open (EUCSTR, code)) == (iconv_t) - 1) {
gd_error ("iconv_open() error");
#ifdef HAVE_ERRNO_H
if (errno == EINVAL)
gd_error ("invalid code specification: \"%s\" or \"%s\"", EUCSTR, code);
#endif
ustrcpy (to, from);
return;
}
@ -357,7 +353,7 @@ do_convert (unsigned char **to_p, const unsigned char **from_p, const char *code
if ((int) (iconv (cd, (char **)from_p, &from_len, (char **)to_p, &to_len))
== -1) {
#ifdef HAVE_ERRNO_H
if (errno == EINVAL)
gd_error ("invalid end of input string");
else if (errno == EILSEQ)
@ -365,7 +361,7 @@ do_convert (unsigned char **to_p, const unsigned char **from_p, const char *code
else if (errno == E2BIG)
gd_error ("output buffer overflow at do_convert()");
else
#endif
gd_error ("something happen");
ustrcpy (to, from);
return;

View File

@ -4,9 +4,7 @@
/* Bring in standard I/O and string manipulation functions */
#include <stdarg.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>

View File

@ -7,7 +7,7 @@
LIBVER=3.0.1
# Misc. config flags.
CDEFS=-DHAVE_ERRNO_H -DHAVE_ICONV -DHAVE_ICONV_H \
CDEFS=-DHAVE_ICONV -DHAVE_ICONV_H \
-DHAVE_ICONV_T_DEF -DHAVE_INTTYPES_H -DHAVE_LIMITS_H -DHAVE_STDDEF_H \
-DHAVE_STDINT_H -DHAVE_STDLIB_H -DHAVE_VISIBILITY -DICONV_CONST