From ca3031bf1b041839bf629ea44f58371796e9ebd5 Mon Sep 17 00:00:00 2001
From: Greg Burd <greg@burd.me>
Date: Tue, 23 Sep 2025 14:11:10 -0400
Subject: [PATCH v1] Avoid triggering warnings in Bitmapset tests related to
 Datum casts

The Bitmapset tests encode/decode bitmaps to/from text using the available
nodeTo/FromString() functions for simplicity.  They don't need for a Datum
manipulation in their conversion macros, as we already allocate the results to
and from "text" before/after using the GETARG or RETURN macros. Using directly
text_to_cstring() and cstring_to_text() takes care of these warnings.
---
 src/test/modules/test_bitmapset/test_bitmapset.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/modules/test_bitmapset/test_bitmapset.c b/src/test/modules/test_bitmapset/test_bitmapset.c
index 61f256f65a4..5bc4daa23f1 100644
--- a/src/test/modules/test_bitmapset/test_bitmapset.c
+++ b/src/test/modules/test_bitmapset/test_bitmapset.c
@@ -84,8 +84,8 @@ PG_FUNCTION_INFO_V1(test_random_operations);
 	} while (0)
 
 /* Encode/Decode to/from TEXT and Bitmapset */
-#define BITMAPSET_TO_TEXT(bms) (text *) CStringGetTextDatum(nodeToString((bms)))
-#define TEXT_TO_BITMAPSET(str) (Bitmapset *) stringToNode(TextDatumGetCString((Datum) (str)))
+#define BITMAPSET_TO_TEXT(bms) cstring_to_text(nodeToString(bms))
+#define TEXT_TO_BITMAPSET(str) ((Bitmapset *) stringToNode(text_to_cstring(str)))
 
 /*
  * Individual test functions for each bitmapset API function
-- 
2.50.1 (Apple Git-155)

