Commit 60d27aba authored by Mark Lindner's avatar Mark Lindner

prefix more internal functions with 'libconfig_'

parent 18193744
......@@ -52,10 +52,6 @@ int main(int argc, char **argv)
return(EXIT_FAILURE);
}
string tmp;
cfg.lookupValue("name", tmp);
std::cout << "name: " << tmp << std::endl;
// Get the store name.
try
{
......
......@@ -212,8 +212,8 @@ static void __config_write_value(const config_t *config,
{
const int sci_ok = config_get_option(
config, CONFIG_OPTION_ALLOW_SCIENTIFIC_NOTATION);
format_double(value->fval, config->float_precision, sci_ok, fbuf,
sizeof(fbuf));
__libconfig_format_double(value->fval, config->float_precision, sci_ok,
fbuf, sizeof(fbuf));
fputs(fbuf, stream);
break;
}
......@@ -719,7 +719,7 @@ int config_write_file(config_t *config, const char *filename)
void config_destroy(config_t *config)
{
__config_setting_destroy(config->root);
__delete_vec(config->filenames);
__libconfig_delete_vec(config->filenames);
__delete(config->include_dir);
__zero(config);
}
......@@ -730,7 +730,7 @@ void config_clear(config_t *config)
{
/* Destroy the root setting (recursively) and then create a new one. */
__config_setting_destroy(config->root);
__delete_vec(config->filenames);
__libconfig_delete_vec(config->filenames);
config->root = __new(config_setting_t);
config->root->type = CONFIG_TYPE_GROUP;
......
......@@ -89,13 +89,13 @@ FILE *libconfig_scanctx_push_include(struct scan_context *ctx, void *prev_buffer
if(*error || !files)
{
__delete_vec(files);
__libconfig_delete_vec(files);
return(NULL);
}
if(!*files)
{
__delete_vec(files);
__libconfig_delete_vec(files);
return(NULL);
}
......
......@@ -1351,7 +1351,7 @@ YY_RULE_SETUP
#line 138 "scanner.l"
{
int ok;
long long llval = parse_integer(yytext, &ok);
long long llval = __libconfig_parse_integer(yytext, &ok);
if(!ok)
return(TOK_ERROR);
......@@ -1383,36 +1383,39 @@ YY_RULE_SETUP
case 37:
YY_RULE_SETUP
#line 160 "scanner.l"
{ yylval->llval = parse_hex64(yytext); return(TOK_HEX64); }
{
yylval->llval = __libconfig_parse_hex64(yytext);
return(TOK_HEX64);
}
YY_BREAK
case 38:
YY_RULE_SETUP
#line 161 "scanner.l"
#line 164 "scanner.l"
{ return(TOK_ARRAY_START); }
YY_BREAK
case 39:
YY_RULE_SETUP
#line 162 "scanner.l"
#line 165 "scanner.l"
{ return(TOK_ARRAY_END); }
YY_BREAK
case 40:
YY_RULE_SETUP
#line 163 "scanner.l"
#line 166 "scanner.l"
{ return(TOK_LIST_START); }
YY_BREAK
case 41:
YY_RULE_SETUP
#line 164 "scanner.l"
#line 167 "scanner.l"
{ return(TOK_LIST_END); }
YY_BREAK
case 42:
YY_RULE_SETUP
#line 165 "scanner.l"
#line 168 "scanner.l"
{ return(TOK_SEMICOLON); }
YY_BREAK
case 43:
YY_RULE_SETUP
#line 166 "scanner.l"
#line 169 "scanner.l"
{ return(TOK_GARBAGE); }
YY_BREAK
case YY_STATE_EOF(INITIAL):
......@@ -1420,7 +1423,7 @@ case YY_STATE_EOF(SINGLE_LINE_COMMENT):
case YY_STATE_EOF(MULTI_LINE_COMMENT):
case YY_STATE_EOF(STRING):
case YY_STATE_EOF(INCLUDE):
#line 168 "scanner.l"
#line 171 "scanner.l"
{
const char *error = NULL;
FILE *fp;
......@@ -1456,10 +1459,10 @@ case YY_STATE_EOF(INCLUDE):
YY_BREAK
case 44:
YY_RULE_SETUP
#line 200 "scanner.l"
#line 203 "scanner.l"
ECHO;
YY_BREAK
#line 1462 "scanner.c"
#line 1465 "scanner.c"
case YY_END_OF_BUFFER:
{
......@@ -2610,4 +2613,4 @@ void yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
#line 200 "scanner.l"
#line 203 "scanner.l"
......@@ -712,7 +712,7 @@ extern int yylex \
#undef yyTABLES_NAME
#endif
#line 200 "scanner.l"
#line 203 "scanner.l"
#line 717 "scanner.h"
#undef libconfig_yyIN_HEADER
......
......@@ -137,7 +137,7 @@ include_open ^[ \t]*@include[ \t]+\"
{float} { yylval->fval = atof(yytext); return(TOK_FLOAT); }
{integer} {
int ok;
long long llval = parse_integer(yytext, &ok);
long long llval = __libconfig_parse_integer(yytext, &ok);
if(!ok)
return(TOK_ERROR);
......@@ -157,7 +157,10 @@ include_open ^[ \t]*@include[ \t]+\"
yylval->ival = strtoul(yytext, NULL, 16);
return(TOK_HEX);
}
{hex64} { yylval->llval = parse_hex64(yytext); return(TOK_HEX64); }
{hex64} {
yylval->llval = __libconfig_parse_hex64(yytext);
return(TOK_HEX64);
}
\[ { return(TOK_ARRAY_START); }
\] { return(TOK_ARRAY_END); }
\( { return(TOK_LIST_START); }
......
......@@ -30,7 +30,7 @@
/* ------------------------------------------------------------------------- */
void __delete_vec(const char *const *v)
void __libconfig_delete_vec(const char *const *v)
{
const char *const *p;
......@@ -44,7 +44,7 @@ void __delete_vec(const char *const *v)
/* ------------------------------------------------------------------------- */
long long parse_integer(const char *s, int *ok)
long long __libconfig_parse_integer(const char *s, int *ok)
{
long long llval;
char *endptr;
......@@ -65,7 +65,7 @@ long long parse_integer(const char *s, int *ok)
/* ------------------------------------------------------------------------- */
unsigned long long parse_hex64(const char *s)
unsigned long long __libconfig_parse_hex64(const char *s)
{
#ifdef __MINGW32__
......@@ -101,8 +101,8 @@ unsigned long long parse_hex64(const char *s)
/* ------------------------------------------------------------------------- */
void format_double(double val, int precision, int sci_ok, char *buf,
size_t buflen)
void __libconfig_format_double(double val, int precision, int sci_ok, char *buf,
size_t buflen)
{
const char *fmt = sci_ok ? "%.*g" : "%.*f";
char *p, *q;
......
......@@ -27,11 +27,11 @@
#define __delete(P) free((void *)(P))
#define __zero(P) memset((void *)(P), 0, sizeof(*P))
extern void __delete_vec(const char * const *v);
extern void __libconfig_delete_vec(const char * const *v);
extern long long parse_integer(const char *s, int *ok);
extern unsigned long long parse_hex64(const char *s);
extern long long __libconfig_parse_integer(const char *s, int *ok);
extern unsigned long long __libconfig_parse_hex64(const char *s);
extern void format_double(double val, int precision, int sci_ok, char *buf,
size_t buflen);
extern void __libconfig_format_double(double val, int precision, int sci_ok,
char *buf, size_t buflen);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment