agora inbox for [email protected]  
help / color / mirror / Atom feed
From: Jonathan Gonzalez V. <[email protected]>
Subject: [PATCH v1 2/2] Collapse SH_CREATE() into a single definition
Date: Wed, 1 Jul 2026 12:36:52 +0200

The function had two conditional definitions that make lcov v2.x fail.
---
 src/include/lib/simplehash.h | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/src/include/lib/simplehash.h b/src/include/lib/simplehash.h
index 15af488abfb..cda4347e60b 100644
--- a/src/include/lib/simplehash.h
+++ b/src/include/lib/simplehash.h
@@ -138,6 +138,14 @@
 #define SH_INSERT_HASH_INTERNAL SH_MAKE_NAME(insert_hash_internal)
 #define SH_LOOKUP_HASH_INTERNAL SH_MAKE_NAME(lookup_hash_internal)
 
+#ifdef SH_RAW_ALLOCATOR
+/* <prefix>_hash <prefix>_create(uint32 nelements, void *private_data) */
+#define SH_CREATE_PARAMETERS uint32 nelements, void *private_data
+#else
+/*  <prefix>_hash <prefix>_create(MemoryContext ctx, uint32 nelements, void *private_data) */
+#define SH_CREATE_PARAMETERS MemoryContext ctx, uint32 nelements, void *private_data
+#endif
+
 /* generate forward declarations necessary to use the hash table */
 #ifdef SH_DECLARE
 
@@ -186,17 +194,7 @@ typedef struct SH_ITERATOR
 }			SH_ITERATOR;
 
 /* externally visible function prototypes */
-#ifdef SH_RAW_ALLOCATOR
-/* <prefix>_hash <prefix>_create(uint32 nelements, void *private_data) */
-SH_SCOPE	SH_TYPE *SH_CREATE(uint32 nelements, void *private_data);
-#else
-/*
- * <prefix>_hash <prefix>_create(MemoryContext ctx, uint32 nelements,
- *								 void *private_data)
- */
-SH_SCOPE	SH_TYPE *SH_CREATE(MemoryContext ctx, uint32 nelements,
-							   void *private_data);
-#endif
+SH_SCOPE	SH_TYPE *SH_CREATE(SH_CREATE_PARAMETERS);
 
 /* void <prefix>_destroy(<prefix>_hash *tb) */
 SH_SCOPE void SH_DESTROY(SH_TYPE * tb);
@@ -442,13 +440,8 @@ SH_FREE(SH_TYPE * type, void *pointer)
  * Memory other than for the array of elements will still be allocated from
  * the passed-in context.
  */
-#ifdef SH_RAW_ALLOCATOR
 SH_SCOPE	SH_TYPE *
-SH_CREATE(uint32 nelements, void *private_data)
-#else
-SH_SCOPE	SH_TYPE *
-SH_CREATE(MemoryContext ctx, uint32 nelements, void *private_data)
-#endif
+SH_CREATE(SH_CREATE_PARAMETERS)
 {
 	SH_TYPE    *tb;
 	uint64		size;
@@ -1217,6 +1210,7 @@ SH_STAT(SH_TYPE * tb)
 #undef SH_GROW_MAX_MOVE
 #undef SH_GROW_MIN_FILLFACTOR
 #undef SH_MAX_SIZE
+#undef SH_CREATE_PARAMETERS
 
 /* types */
 #undef SH_TYPE
-- 
2.53.0


--=-=-=--





view thread (9+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v1 2/2] Collapse SH_CREATE() into a single definition
  In-Reply-To: <no-message-id-659064@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox