Doc: clarify a critical and undocumented aspect of simplehash.h.
authorTom Lane <[email protected]>
Thu, 21 Oct 2021 21:08:53 +0000 (17:08 -0400)
committerTom Lane <[email protected]>
Thu, 21 Oct 2021 21:08:53 +0000 (17:08 -0400)
I just got burnt by trying to use pg_malloc instead of pg_malloc0
with this.  Save the next hacker some time by not leaving this
API detail undocumented.

src/include/lib/simplehash.h

index f6cbcd8c176f99ababf46eda324a1f57a1da31a7..60ab472540d157d48a0a2e3114f8a22ff72bb04e 100644 (file)
@@ -41,7 +41,7 @@
  *       - SH_SCOPE - in which scope (e.g. extern, static inline) do function
  *             declarations reside
  *       - SH_RAW_ALLOCATOR - if defined, memory contexts are not used; instead,
- *         use this to allocate bytes
+ *         use this to allocate bytes. The allocator must zero the returned space.
  *       - SH_USE_NONDEFAULT_ALLOCATOR - if defined no element allocator functions
  *             are defined, so you can supply your own
  *       The following parameters are only relevant when SH_DEFINE is defined: