summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog16
-rwxr-xr-xMODULES.html.sh1
-rw-r--r--NEWS6
-rw-r--r--lib/xstrtol-error.c2
-rw-r--r--lib/xstrtol-error.h45
-rw-r--r--lib/xstrtol.h20
-rw-r--r--modules/xstrtol7
-rw-r--r--modules/xstrtol-error27
-rw-r--r--modules/xstrtol-tests1
-rw-r--r--tests/test-xstrtol.c2
10 files changed, 99 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 493211d667..f00b84cc78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2019-12-05 Pino Toscano <ptoscano@redhat.com>
+
+ Move xstrtol_fatal to a new xstrtol-error module.
+ * lib/xstrtol.h: Stop including <getopt.h>.
+ (xstrtol_fatal): Move ...
+ * lib/xstrtol-error.h: ... here. New file.
+ * lib/xstrtol-error.c: Include xstrtol-error.h instead of xstrtol.h.
+ * tests/test-xstrtol.c: Likewise.
+ * modules/xstrtol (Files): Remove lib/xstrtol-error.c.
+ (Depends-on): Remove exitfail, error, getopt-gnu, and gettext-h.
+ (Makefile.am): Remove xstrtol-error.c from lib_SOURCES.
+ * modules/xstrtol-error: New file.
+ * modules/xstrtol-tests (Depends-on): Add xstrtol-error.
+ * MODULES.html.sh: Add xstrtol-error.
+ * NEWS: Document the change.
+
2019-12-06 Paul Eggert <eggert@cs.ucla.edu>
nstrftime: better width support for %N, %z
diff --git a/MODULES.html.sh b/MODULES.html.sh
index 107f16cc26..2ed3bf9052 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -1861,6 +1861,7 @@ func_all_modules ()
func_module c-strtold
func_module xstrtod
func_module xstrtol
+ func_module xstrtol-error
func_module xstrtoll
func_module xstrtold
func_end_table
diff --git a/NEWS b/NEWS
index 2655d7fc93..c0fe790e77 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,12 @@ Important general notes
Date Modules Changes
+2019-12-07 userspec The xstrtol_fatal is moved away from the xstrtol
+ xstrtoimax module to a new xstrtol-error module. Because of
+ xstrtol this, using xstrtol or any of the modules using it
+ xstrtoll does not pull automatically the exitfail, error,
+ xstrtoumax getopt-gnu, and gettext-h modules.
+
2019-03-16 fatal-signal The function that you pass to at_fatal_signal now
takes the signal as argument.
diff --git a/lib/xstrtol-error.c b/lib/xstrtol-error.c
index a0d10c2856..386d22b2d9 100644
--- a/lib/xstrtol-error.c
+++ b/lib/xstrtol-error.c
@@ -17,7 +17,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>. */
#include <config.h>
-#include "xstrtol.h"
+#include "xstrtol-error.h"
#include <stdlib.h>
diff --git a/lib/xstrtol-error.h b/lib/xstrtol-error.h
new file mode 100644
index 0000000000..a9cd940a41
--- /dev/null
+++ b/lib/xstrtol-error.h
@@ -0,0 +1,45 @@
+/* Error reporting interface for xstrto* functions.
+
+ Copyright (C) 1995-1996, 1998-1999, 2001-2004, 2006-2019 Free Software
+ Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
+
+#ifndef XSTRTOL_ERROR_H_
+# define XSTRTOL_ERROR_H_ 1
+
+# include "xstrtol.h"
+
+# include <getopt.h>
+
+/* Report an error for an invalid integer in an option argument.
+
+ ERR is the error code returned by one of the xstrto* functions.
+
+ Use OPT_IDX to decide whether to print the short option string "C"
+ or "-C" or a long option string derived from LONG_OPTION. OPT_IDX
+ is -2 if the short option "C" was used, without any leading "-"; it
+ is -1 if the short option "-C" was used; otherwise it is an index
+ into LONG_OPTIONS, which should have a name preceded by two '-'
+ characters.
+
+ ARG is the option-argument containing the integer.
+
+ After reporting an error, exit with a failure status. */
+
+_Noreturn void xstrtol_fatal (enum strtol_error,
+ int, char, struct option const *,
+ char const *);
+
+#endif /* not XSTRTOL_ERROR_H_ */
diff --git a/lib/xstrtol.h b/lib/xstrtol.h
index fff320d504..d888120e6b 100644
--- a/lib/xstrtol.h
+++ b/lib/xstrtol.h
@@ -19,7 +19,6 @@
#ifndef XSTRTOL_H_
# define XSTRTOL_H_ 1
-# include <getopt.h>
# include <inttypes.h>
# ifndef _STRTOL_ERROR
@@ -51,23 +50,4 @@ _DECLARE_XSTRTOL (xstrtoll, long long int)
_DECLARE_XSTRTOL (xstrtoull, unsigned long long int)
#endif
-/* Report an error for an invalid integer in an option argument.
-
- ERR is the error code returned by one of the xstrto* functions.
-
- Use OPT_IDX to decide whether to print the short option string "C"
- or "-C" or a long option string derived from LONG_OPTION. OPT_IDX
- is -2 if the short option "C" was used, without any leading "-"; it
- is -1 if the short option "-C" was used; otherwise it is an index
- into LONG_OPTIONS, which should have a name preceded by two '-'
- characters.
-
- ARG is the option-argument containing the integer.
-
- After reporting an error, exit with a failure status. */
-
-_Noreturn void xstrtol_fatal (enum strtol_error,
- int, char, struct option const *,
- char const *);
-
#endif /* not XSTRTOL_H_ */
diff --git a/modules/xstrtol b/modules/xstrtol
index 26240ecc99..a765f97452 100644
--- a/modules/xstrtol
+++ b/modules/xstrtol
@@ -5,22 +5,17 @@ Files:
lib/xstrtol.h
lib/xstrtol.c
lib/xstrtoul.c
-lib/xstrtol-error.c
m4/xstrtol.m4
Depends-on:
assure
-exitfail
-error
-getopt-gnu
-gettext-h
inttypes-incomplete
configure.ac:
gl_XSTRTOL
Makefile.am:
-lib_SOURCES += xstrtol.c xstrtoul.c xstrtol-error.c
+lib_SOURCES += xstrtol.c xstrtoul.c
Include:
"xstrtol.h"
diff --git a/modules/xstrtol-error b/modules/xstrtol-error
new file mode 100644
index 0000000000..9c3da2a5ab
--- /dev/null
+++ b/modules/xstrtol-error
@@ -0,0 +1,27 @@
+Description:
+Error reporting function for xstrto* functions.
+
+Files:
+lib/xstrtol-error.c
+lib/xstrtol-error.h
+
+Depends-on:
+xstrtol
+error
+exitfail
+getopt-gnu
+gettext-h
+
+configure.ac:
+
+Makefile.am:
+lib_SOURCES += xstrtol-error.c
+
+Include:
+"xstrtol-error.h"
+
+License:
+GPL
+
+Maintainer:
+Jim Meyering
diff --git a/modules/xstrtol-tests b/modules/xstrtol-tests
index da11c19608..1786873d07 100644
--- a/modules/xstrtol-tests
+++ b/modules/xstrtol-tests
@@ -6,6 +6,7 @@ tests/test-xstrtol.sh
Depends-on:
inttypes
test-framework-sh
+xstrtol-error
configure.ac:
diff --git a/tests/test-xstrtol.c b/tests/test-xstrtol.c
index 7f9df2e3fa..ffac9bdead 100644
--- a/tests/test-xstrtol.c
+++ b/tests/test-xstrtol.c
@@ -20,7 +20,7 @@
#include <stdlib.h>
#include <stdio.h>
-#include "xstrtol.h"
+#include "xstrtol-error.h"
#include "error.h"
#ifndef __xstrtol