mirror of
https://git.zx2c4.com/cgit
synced 2024-11-25 18:08:41 +00:00
ui-shared: ban strcat()
Git upstream bans strcat() with commit: banned.h: mark strcat() as banned 1b11b64b815db62f93a04242e4aed5687a448748 To avoid compiler warnings from gcc 8.1.x we get the hard way. Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
parent
edb3403f00
commit
2fc008d6de
12
ui-shared.c
12
ui-shared.c
@ -1159,7 +1159,7 @@ void cgit_print_snapshot_links(const struct cgit_repo *repo, const char *ref,
|
|||||||
|
|
||||||
void cgit_set_title_from_path(const char *path)
|
void cgit_set_title_from_path(const char *path)
|
||||||
{
|
{
|
||||||
size_t path_len, path_index, path_last_end;
|
size_t path_len, path_index, path_last_end, line_len;
|
||||||
char *new_title;
|
char *new_title;
|
||||||
|
|
||||||
if (!path)
|
if (!path)
|
||||||
@ -1176,14 +1176,18 @@ void cgit_set_title_from_path(const char *path)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
strncat(new_title, &path[path_index + 1], path_last_end - path_index - 1);
|
strncat(new_title, &path[path_index + 1], path_last_end - path_index - 1);
|
||||||
strcat(new_title, "\\");
|
line_len = strlen(new_title);
|
||||||
|
new_title[line_len++] = '\\';
|
||||||
|
new_title[line_len] = '\0';
|
||||||
path_last_end = path_index;
|
path_last_end = path_index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (path_last_end)
|
if (path_last_end)
|
||||||
strncat(new_title, path, path_last_end);
|
strncat(new_title, path, path_last_end);
|
||||||
|
|
||||||
strcat(new_title, " - ");
|
line_len = strlen(new_title);
|
||||||
strcat(new_title, ctx.page.title);
|
memcpy(&new_title[line_len], " - ", 3);
|
||||||
|
new_title[line_len + 3] = '\0';
|
||||||
|
strncat(new_title, ctx.page.title, sizeof(new_title) - strlen(new_title) - 1);
|
||||||
ctx.page.title = new_title;
|
ctx.page.title = new_title;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user