From: Patrick Steinhardt Date: Fri, 7 Jun 2024 06:38:39 +0000 (+0200) Subject: pretty: add casts for decoration option pointers X-Git-Tag: v2.46.0-rc0~52^2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c076c32fbb15a0887a1ed4d2afa7e5a3fd74727;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/pretty.c b/pretty.c index ec05db5655..1df9d635fb 100644 --- a/pretty.c +++ b/pretty.c @@ -1584,8 +1584,8 @@ static size_t format_commit_one(struct strbuf *sb, /* in UTF-8 */ case 'D': { const struct decoration_options opts = { - .prefix = "", - .suffix = "" + .prefix = (char *) "", + .suffix = (char *) "", }; format_decorations(sb, commit, c->auto_color, &opts);