diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2023-02-28 11:01:05 +0400 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2023-03-01 15:36:40 +1100 |
commit | 5b60f5104fccb12964632b07a49011a222522d84 (patch) | |
tree | fda0df3901453bdb92c24993ff54d18c80f8a6c2 | |
parent | 32174a66efa4ad19fc6a2a6422e4af2ae4f055cb (diff) | |
download | device-tree-compiler-5b60f5104fccb12964632b07a49011a222522d84.tar.gz |
srcpos.c: fix -Wwrite-strings
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r-- | srcpos.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -313,8 +313,8 @@ srcpos_string(struct srcpos *pos) static char * srcpos_string_comment(struct srcpos *pos, bool first_line, int level) { - char *pos_str, *fname, *first, *rest; - bool fresh_fname = false; + char *pos_str, *fresh_fname = NULL, *first, *rest; + const char *fname; if (!pos) { if (level > 1) { @@ -332,9 +332,9 @@ srcpos_string_comment(struct srcpos *pos, bool first_line, int level) else if (level > 1) fname = pos->file->name; else { - fname = shorten_to_initial_path(pos->file->name); - if (fname) - fresh_fname = true; + fresh_fname = shorten_to_initial_path(pos->file->name); + if (fresh_fname) + fname = fresh_fname; else fname = pos->file->name; } @@ -348,7 +348,7 @@ srcpos_string_comment(struct srcpos *pos, bool first_line, int level) first_line ? pos->first_line : pos->last_line); if (fresh_fname) - free(fname); + free(fresh_fname); if (pos->next != NULL) { rest = srcpos_string_comment(pos->next, first_line, level); |