xref: /aosp_15_r20/external/libconfig/lib/util.h (revision 2e9d491483b805f09ea864149eadd5680efcc72a)
1 /* ----------------------------------------------------------------------------
2    libconfig - A library for processing structured configuration files
3    Copyright (C) 2005-2018  Mark A Lindner
4 
5    This file is part of libconfig.
6 
7    This library is free software; you can redistribute it and/or
8    modify it under the terms of the GNU Lesser General Public License
9    as published by the Free Software Foundation; either version 2.1 of
10    the License, or (at your option) any later version.
11 
12    This library is distributed in the hope that it will be useful, but
13    WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15    Lesser General Public License for more details.
16 
17    You should have received a copy of the GNU Library General Public
18    License along with this library; if not, see
19    <http://www.gnu.org/licenses/>.
20    ----------------------------------------------------------------------------
21 */
22 
23 #include <string.h>
24 #include <sys/types.h>
25 
26 #define __new(T) (T *)calloc(1, sizeof(T)) /* zeroed */
27 #define __delete(P) free((void *)(P))
28 #define __zero(P) memset((void *)(P), 0, sizeof(*P))
29 
30 extern long long libconfig_parse_integer(const char *s, int *ok);
31 extern unsigned long long libconfig_parse_hex64(const char *s);
32 
33 extern void libconfig_format_double(double val, int precision, int sci_ok,
34                                     char *buf, size_t buflen);
35 
36