From f77723ad33a89f48ddcd5dcd628a8061fb41d18b Mon Sep 17 00:00:00 2001 From: George Dunlap Date: Tue, 15 May 2012 16:28:12 +0100 Subject: libxlu: Rename filename to config_source The "filename" is a bit of a misnomer, as it's only used during error messages, and in most instances cases is actually set to "command line". Rename it to "config_source" to make it clear that it's not used to actually open any files. No functional changes. Signed-off-by: George Dunlap Committed-by: Ian Campbell --- tools/libxl/libxlu_cfg.c | 22 +++++++++++----------- tools/libxl/libxlu_disk.c | 2 +- tools/libxl/libxlu_internal.h | 2 +- tools/libxl/libxlu_vif.c | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/libxl/libxlu_cfg.c b/tools/libxl/libxlu_cfg.c index c32cf046c1..22adcb0c86 100644 --- a/tools/libxl/libxlu_cfg.c +++ b/tools/libxl/libxlu_cfg.c @@ -25,15 +25,15 @@ #include "libxlu_cfg_l.h" #include "libxlu_cfg_i.h" -XLU_Config *xlu_cfg_init(FILE *report, const char *report_filename) { +XLU_Config *xlu_cfg_init(FILE *report, const char *report_source) { XLU_Config *cfg; cfg= malloc(sizeof(*cfg)); if (!cfg) return 0; cfg->report= report; - cfg->filename= strdup(report_filename); - if (!cfg->filename) { free(cfg); return 0; } + cfg->config_source= strdup(report_source); + if (!cfg->config_source) { free(cfg); return 0; } cfg->settings= 0; return cfg; @@ -51,7 +51,7 @@ static int ctx_prep(CfgParseContext *ctx, XLU_Config *cfg) { e= xlu__cfg_yylex_init_extra(ctx, &ctx->scanner); if (e) { fprintf(cfg->report,"%s: unable to create scanner: %s\n", - cfg->filename, strerror(e)); + cfg->config_source, strerror(e)); return e; } return 0; @@ -117,7 +117,7 @@ int xlu_cfg_readdata(XLU_Config *cfg, const char *data, int length) { buf = xlu__cfg_yy_scan_bytes(data, length, ctx.scanner); if (!buf) { fprintf(cfg->report,"%s: unable to allocate scanner buffer\n", - cfg->filename); + cfg->config_source); ctx.err= ENOMEM; goto xe; } @@ -151,7 +151,7 @@ void xlu_cfg_destroy(XLU_Config *cfg) { set_next= set->next; xlu__cfg_set_free(set); } - free(cfg->filename); + free(cfg->config_source); free(cfg); } @@ -178,7 +178,7 @@ static int find_atom(const XLU_Config *cfg, const char *n, fprintf(cfg->report, "%s:%d: warning: parameter `%s' is" " a list but should be a single value\n", - cfg->filename, set->lineno, n); + cfg->config_source, set->lineno, n); return EINVAL; } *set_r= set; @@ -223,14 +223,14 @@ int xlu_cfg_get_long(const XLU_Config *cfg, const char *n, fprintf(cfg->report, "%s:%d: warning: parameter `%s' could not be parsed" " as a number: %s\n", - cfg->filename, set->lineno, n, strerror(e)); + cfg->config_source, set->lineno, n, strerror(e)); return e; } if (*ep || ep==set->values[0]) { if (!dont_warn) fprintf(cfg->report, "%s:%d: warning: parameter `%s' is not a valid number\n", - cfg->filename, set->lineno, n); + cfg->config_source, set->lineno, n); return EINVAL; } *value_r= l; @@ -258,7 +258,7 @@ int xlu_cfg_get_list(const XLU_Config *cfg, const char *n, fprintf(cfg->report, "%s:%d: warning: parameter `%s' is a single value" " but should be a list\n", - cfg->filename, set->lineno, n); + cfg->config_source, set->lineno, n); } return EINVAL; } @@ -467,7 +467,7 @@ void xlu__cfg_yyerror(YYLTYPE *loc, CfgParseContext *ctx, char const *msg) { fprintf(ctx->cfg->report, "%s:%d: config parsing error near %s%.*s%s%s: %s\n", - ctx->cfg->filename, lineno, + ctx->cfg->config_source, lineno, len?"`":"", len, text, len?"'":"", newline, msg); if (!ctx->err) ctx->err= EINVAL; diff --git a/tools/libxl/libxlu_disk.c b/tools/libxl/libxlu_disk.c index 6cd86e94bc..3d51defe1e 100644 --- a/tools/libxl/libxlu_disk.c +++ b/tools/libxl/libxlu_disk.c @@ -10,7 +10,7 @@ void xlu__disk_err(DiskParseContext *dpc, const char *erroneous, "%s: config parsing error in disk specification: %s" "%s%s%s" " in `%s'\n", - dpc->cfg->filename, message, + dpc->cfg->config_source, message, erroneous?": near `":"", erroneous?erroneous:"", erroneous?"'":"", dpc->spec); if (!dpc->err) dpc->err= EINVAL; diff --git a/tools/libxl/libxlu_internal.h b/tools/libxl/libxlu_internal.h index c7026854bf..7579158f75 100644 --- a/tools/libxl/libxlu_internal.h +++ b/tools/libxl/libxlu_internal.h @@ -38,7 +38,7 @@ struct XLU_ConfigSetting { /* transparent */ struct XLU_Config { XLU_ConfigSetting *settings; FILE *report; - char *filename; + char *config_source; }; typedef struct { diff --git a/tools/libxl/libxlu_vif.c b/tools/libxl/libxlu_vif.c index e3f78a3f8d..3b3de0f811 100644 --- a/tools/libxl/libxlu_vif.c +++ b/tools/libxl/libxlu_vif.c @@ -7,7 +7,7 @@ static const char *vif_internal_usec_re = "^[0-9]+[mu]?s?$"; static void xlu__vif_err(XLU_Config *cfg, const char *msg, const char *rate) { fprintf(cfg->report, "%s: config parsing error in vif: %s in `%s'\n", - cfg->filename, msg, rate); + cfg->config_source, msg, rate); } static int vif_parse_rate_bytes_per_sec(XLU_Config *cfg, const char *bytes, -- cgit v1.2.3