Skip to content

Commit 9c076c3

Browse files
pks-tgitster
authored andcommitted
pretty: add casts for decoration option pointers
The `struct decoration_options` have a prefix and suffix field which are both non-constant, but we assign a constant pointer to them. This is safe to do because we pass them to `format_decorations()`, which never modifies these pointers, and then immediately discard the structure. Add explicit casts to avoid compilation warnings with `-Wwrite-strings`. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9f03e48 commit 9c076c3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pretty.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,8 +1584,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
15841584
case 'D':
15851585
{
15861586
const struct decoration_options opts = {
1587-
.prefix = "",
1588-
.suffix = ""
1587+
.prefix = (char *) "",
1588+
.suffix = (char *) "",
15891589
};
15901590

15911591
format_decorations(sb, commit, c->auto_color, &opts);

0 commit comments

Comments
 (0)