Hi, During an internal company knowledge-sharing session, I spotted a small issue in simplehash.h.
A typical way to define a simple hash table looks like this: ``` /* * Define a hash table which we can use to store information about the files * mentioned in the backup manifest. */ #define SH_PREFIX manifest_files #define SH_ELEMENT_TYPE manifest_file #define SH_KEY_TYPE const char * #define SH_KEY pathname #define SH_HASH_KEY(tb, key) hash_string(key) #define SH_EQUAL(tb, a, b) (strcmp(a, b) == 0) #define SH_SCOPE extern #define SH_RAW_ALLOCATOR pg_malloc0 #define SH_DEFINE #include "lib/simplehash.h" ``` At the end of simplehash.h, the macros are undefined so that another hash table can be defined: ``` /* undefine external parameters, so next hash table can be defined */ #undef SH_PREFIX #undef SH_KEY_TYPE #undef SH_KEY #undef SH_ELEMENT_TYPE #undef SH_HASH_KEY #undef SH_SCOPE #undef SH_DECLARE #undef SH_DEFINE #undef SH_GET_HASH #undef SH_STORE_HASH #undef SH_USE_NONDEFAULT_ALLOCATOR #undef SH_EQUAL ``` However, SH_RAW_ALLOCATOR is missing from this list. This trivial patch just adds the missing #undef SH_RAW_ALLOCATOR. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/
v1-0001-simplehash-Undefine-SH_RAW_ALLOCATOR-after-inclus.patch
Description: Binary data
