util/blob: Fix const correctness warning in blob_read_string

Fix compiler error:

  ../src/util/blob.c:344:8: error: assigning to 'uint8_t *' from
  'const void *' discards qualifiers
  [-Werror,-Wincompatible-pointer-types-discards-qualifiers]

glibc now provides C23-style type-generic string functions. memchr
returns const void * when passed a const void * argument. Update nul
declaration to const since it's only used to find the null terminator
position and calculate a size.

Fixes: 1c9877327e ("glsl: Add blob.c---a simple interface for serializing data")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
(cherry picked from commit b40850b24a)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39462>
This commit is contained in:
Vinson Lee 2025-12-19 22:10:18 -08:00 committed by Dylan Baker
parent 35251391c8
commit a96da583fa
2 changed files with 2 additions and 2 deletions

View file

@ -964,7 +964,7 @@
"description": "util/blob: Fix const correctness warning in blob_read_string",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "1c9877327ead37b7dd5a0ca3a8c7912e924328e5",
"notes": null

View file

@ -330,7 +330,7 @@ blob_read_string(struct blob_reader *blob)
{
int size;
char *ret;
uint8_t *nul;
const uint8_t *nul;
/* If we're already at the end, then this is an overrun. */
if (blob->current >= blob->end) {