On Wed, 2019-07-17 at 11:59 -0700, Andres Freund wrote:
> I've not tested it, but this looks reasonable to me. Do you actually
> need the lookup variant, or is that more for completeness?
Yes. If the hash table is full, I do a lookup. If not, I do an insert.
> nitpick^3: I'd s/This is intended for use/The immediate use-case is/
OK.
> > +static inline SH_ELEMENT_TYPE *
> > +SH_INSERT_HASH_INTERNAL(SH_TYPE * tb, SH_KEY_TYPE key, uint32
> > hash, bool *found)
>
> I'd perhaps add a comment here along the lines of:
>
> /*
> * This is a separate static inline function, so it can be reliably
> be inlined
> * into its wrapper functions even if SH_SCOPE is extern.
> */
Will do.
Regards,
Jeff