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