Browse Source

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>
main
Marc-André Lureau 2 years ago committed by David Gibson
parent
commit
5b60f5104f
  1. 12
      srcpos.c

12
srcpos.c

@ -313,8 +313,8 @@ srcpos_string(struct srcpos *pos) @@ -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) @@ -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) @@ -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);

Loading…
Cancel
Save