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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Patrick Steinhardt committed
Jun 7, 2024 at 08:38 UTC
9c076c32fbb15a0887a1ed4d2afa7e5a3fd74727
1 file changed
+2
-2
pretty.c
+2
-2
@@ -1584,8 +1584,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */
1584
case 'D':
1585
{
1586
const struct decoration_options opts = {
1587
- .prefix = "",
1588
- .suffix = ""
1587
+ .prefix = (char *) "",
1588
+ .suffix = (char *) "",
1589
};
1590
1591
format_decorations(sb, commit, c->auto_color, &opts);