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