diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-06-07 08:37:52 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-06-07 10:30:49 -0700 |
| commit | 66f892bb075f19bed784b86c7850a89c9a865aca (patch) | |
| tree | 8549dfeb0440f64135efcb15528fe105f7b18240 /diff.c | |
| parent | refs/reftable: stop micro-optimizing refname allocations on copy (diff) | |
| download | git-66f892bb075f19bed784b86c7850a89c9a865aca.tar.gz git-66f892bb075f19bed784b86c7850a89c9a865aca.zip | |
reftable: cast away constness when assigning constants to records
The reftable records are used in multiple ways throughout the reftable
library. In many of those cases they merely act as input to a function
without getting modified by it at all. Most importantly, this happens
when writing records and when querying for records.
We rely on this in our tests and thus assign string constants to those
fields, which is about to generate warnings as those fields are of type
`char *`. While we could go through the process and instead allocate
those strings in all of our tests, this feels quite unnecessary.
Instead, add casts to `char *` for all of those strings. As this is part
of our tests, this also nicely serves as a demonstration that nothing
writes or frees those string constants, which would otherwise lead to
segfaults.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
0 files changed, 0 insertions, 0 deletions
