1 /* Convert decimal strings with bounds checking and exit on error.
2 
3    Copyright (C) 2014-2023 Free Software Foundation, Inc.
4 
5    This program is free software: you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
17 
18 #ifndef XDECTOINT_H_
19 # define XDECTOINT_H_ 1
20 
21 # include <inttypes.h>
22 
23 # define _DECLARE_XDECTOINT(name, type) \
24   type name (char const *n_str, type min, type max, \
25              char const *suffixes, char const *err, int err_exit) \
26     _GL_ATTRIBUTE_NONNULL ((1, 5));
27 # define _DECLARE_XNUMTOINT(name, type) \
28   type name (char const *n_str, int base, type min, type max, \
29              char const *suffixes, char const *err, int err_exit) \
30     _GL_ATTRIBUTE_NONNULL ((1, 6));
31 
32 _DECLARE_XDECTOINT (xdectoimax, intmax_t)
33 _DECLARE_XDECTOINT (xdectoumax, uintmax_t)
34 
35 _DECLARE_XNUMTOINT (xnumtoimax, intmax_t)
36 _DECLARE_XNUMTOINT (xnumtoumax, uintmax_t)
37 
38 #endif  /* not XDECTOINT_H_ */
39