From c7a5c430c08f935671597fd8009d9f47b4c869ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Faist?= Date: Mon, 24 Mar 2025 13:27:39 +0100 Subject: [PATCH] Fix pointer truncation warning Fixes warning 'type cast': pointer truncation from 'strbuf_t *' to 'long' --- strbuf.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/strbuf.c b/strbuf.c index 7c59e1b..fa8b6a0 100644 --- a/strbuf.c +++ b/strbuf.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "strbuf.h" @@ -94,8 +96,8 @@ void strbuf_set_increment(strbuf_t *s, int increment) static inline void debug_stats(strbuf_t *s) { if (s->debug) { - fprintf(stderr, "strbuf(%lx) reallocs: %d, length: %d, size: %d\n", - (long)s, s->reallocs, s->length, s->size); + fprintf(stderr, "strbuf(%" PRIxPTR ") reallocs: %d, length: %d, size: %d\n", + (uintptr_t)s, s->reallocs, s->length, s->size); } } @@ -168,8 +170,8 @@ void strbuf_resize(strbuf_t *s, int len) newsize = calculate_new_size(s, len); if (s->debug > 1) { - fprintf(stderr, "strbuf(%lx) resize: %d => %d\n", - (long)s, s->size, newsize); + fprintf(stderr, "strbuf(%" PRIxPTR ") resize: %d => %d\n", + (uintptr_t)s, s->size, newsize); } s->size = newsize;