From 0d4461484bd2009fc92be44a608892dbdedb9863 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 7 May 2013 03:17:00 -0600 Subject: [PATCH] Polish: show file path on Bungled lines Since include directive was added it is entirely possible that two files are loaded from the same filename on different paths. This also enables automated tools to make use of the displayed filename to manipulate the relevant file. --- src/cache_cf.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index ca774bf54d..598de58dc0 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -300,14 +300,10 @@ update_maxobjsize(void) static void SetConfigFilename(char const *file_name, bool is_pipe) { - cfg_filename = file_name; - - char const *token; - if (is_pipe) cfg_filename = file_name + 1; - else if ((token = strrchr(cfg_filename, '/'))) - cfg_filename = token + 1; + else + cfg_filename = file_name; } static const char* @@ -528,7 +524,7 @@ parseOneConfigFile(const char *file_name, unsigned int depth) if ((token = strchr(new_file_name, '"'))) *token = '\0'; - cfg_filename = new_file_name; + SetConfigFilename(new_file_name, false); } config_lineno = new_lineno; @@ -598,7 +594,7 @@ parseOneConfigFile(const char *file_name, unsigned int depth) fclose(fp); } - cfg_filename = orig_cfg_filename; + SetConfigFilename(orig_cfg_filename, false); config_lineno = orig_config_lineno; xfree(tmp_line); -- 2.47.2