summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Kokot <peterkokot@gmail.com>2018-09-05 01:02:44 +0200
committerMike Frysinger <vapier@gmail.com>2018-09-05 01:39:49 -0400
commit1e7f93922fb3adf9f131d7e94aa13386062ffe11 (patch)
tree7b06263ffa91058586e27c5936e6eeebb4187c90
parent96d68e36142a3a6446ca7d1d7f764c0156bb2b1e (diff)
downloadlibgd-1e7f93922fb3adf9f131d7e94aa13386062ffe11.tar.gz
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
-rw-r--r--VMS/CONFIGURE.COM5
-rw-r--r--cmake/modules/AC_HEADER_STDC.cmake1
-rw-r--r--configure.ac1
-rw-r--r--docs/README.JPN2
-rw-r--r--src/config.h.cmake3
-rw-r--r--src/gdkanji.c12
-rw-r--r--src/webpng.c2
-rw-r--r--windows/msys/Makefile2
8 files changed, 6 insertions, 22 deletions
diff --git a/VMS/CONFIGURE.COM b/VMS/CONFIGURE.COM
index f9a93ab..a16e021 100644
--- a/VMS/CONFIGURE.COM
+++ b/VMS/CONFIGURE.COM
@@ -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
diff --git a/cmake/modules/AC_HEADER_STDC.cmake b/cmake/modules/AC_HEADER_STDC.cmake
index d3775ea..3f43daa 100644
--- a/cmake/modules/AC_HEADER_STDC.cmake
+++ b/cmake/modules/AC_HEADER_STDC.cmake
@@ -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)
diff --git a/configure.ac b/configure.ac
index bdd7a74..db5db52 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/docs/README.JPN b/docs/README.JPN
index c623cb1..220a013 100644
--- a/docs/README.JPN
+++ b/docs/README.JPN
@@ -24,7 +24,7 @@ SJIS encoding のフォントが使用できます。
漢字コードの変換に OS 付属の iconv() を使う場合は
CFLAGS に -DHAVE_ICONV を付けてコンパイルしてください。
-この場合に -DHAVE_STDARG_H と -DHAVE_ERRNO_H も付けておくと
+この場合に -DHAVE_STDARG_H と も付けておくと
漢字コード変換の際にエラーが発生した場合に適切なメッセージを
表示するようになります。
diff --git a/src/config.h.cmake b/src/config.h.cmake
index 39a46ba..ece37e3 100644
--- a/src/config.h.cmake
+++ b/src/config.h.cmake
@@ -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
diff --git a/src/gdkanji.c b/src/gdkanji.c
index 93380d8..9c8fd11 100644
--- a/src/gdkanji.c
+++ b/src/gdkanji.c
@@ -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;
diff --git a/src/webpng.c b/src/webpng.c
index 2dff832..f7a97ec 100644
--- a/src/webpng.c
+++ b/src/webpng.c
@@ -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>
diff --git a/windows/msys/Makefile b/windows/msys/Makefile
index 3af2faa..c502d80 100644
--- a/windows/msys/Makefile
+++ b/windows/msys/Makefile
@@ -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