diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-06-07 08:38:39 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-07 19:30:52 +0200 |
commit | 9c076c32fbb15a0887a1ed4d2afa7e5a3fd74727 (patch) | |
tree | 62e968edd5811b011ab651010eb4a97b89d7ac57 /pretty.c | |
parent | object-file: make `buf` parameter of `index_mem()` a constant (diff) | |
download | git-9c076c32fbb15a0887a1ed4d2afa7e5a3fd74727.tar.xz git-9c076c32fbb15a0887a1ed4d2afa7e5a3fd74727.zip |
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>
Diffstat (limited to 'pretty.c')
-rw-r--r-- | pretty.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |