mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
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>
This commit is contained in:
parent
32174a66ef
commit
5b60f5104f
1 changed files with 6 additions and 6 deletions
12
srcpos.c
12
srcpos.c
|
@ -313,8 +313,8 @@ srcpos_string(struct srcpos *pos)
|
||||||
static char *
|
static char *
|
||||||
srcpos_string_comment(struct srcpos *pos, bool first_line, int level)
|
srcpos_string_comment(struct srcpos *pos, bool first_line, int level)
|
||||||
{
|
{
|
||||||
char *pos_str, *fname, *first, *rest;
|
char *pos_str, *fresh_fname = NULL, *first, *rest;
|
||||||
bool fresh_fname = false;
|
const char *fname;
|
||||||
|
|
||||||
if (!pos) {
|
if (!pos) {
|
||||||
if (level > 1) {
|
if (level > 1) {
|
||||||
|
@ -332,9 +332,9 @@ srcpos_string_comment(struct srcpos *pos, bool first_line, int level)
|
||||||
else if (level > 1)
|
else if (level > 1)
|
||||||
fname = pos->file->name;
|
fname = pos->file->name;
|
||||||
else {
|
else {
|
||||||
fname = shorten_to_initial_path(pos->file->name);
|
fresh_fname = shorten_to_initial_path(pos->file->name);
|
||||||
if (fname)
|
if (fresh_fname)
|
||||||
fresh_fname = true;
|
fname = fresh_fname;
|
||||||
else
|
else
|
||||||
fname = pos->file->name;
|
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);
|
first_line ? pos->first_line : pos->last_line);
|
||||||
|
|
||||||
if (fresh_fname)
|
if (fresh_fname)
|
||||||
free(fname);
|
free(fresh_fname);
|
||||||
|
|
||||||
if (pos->next != NULL) {
|
if (pos->next != NULL) {
|
||||||
rest = srcpos_string_comment(pos->next, first_line, level);
|
rest = srcpos_string_comment(pos->next, first_line, level);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue