The definition of hashctl is shown below

typedef struct HASHCTL
{
      long           num_partitions; /* # partitions (must be power of 2) */
      long           ssize;                 /* segment size */
      long           dsize;                 /* (initial) directory size */
      long           max_dsize;             /* limit to dsize if dir
size is limited */
      long           ffactor;               /* fill factor */
      Size           keysize;               /* hash key length in bytes */
      Size           entrysize;             /* total user element size
in bytes */
      HashValueFunc hash;                     /* hash function */
      HashCompareFunc match;         /* key comparison function */
      HashCopyFunc keycopy;           /* key copying function */
      HashAllocFunc alloc;           /* memory allocator */
      MemoryContext hcxt;                     /* memory context to use
for allocations */
      HASHHDR   *hctl;                       /* location of header in
shared mem */
} HASHCTL;


/*
* Key copying functions must have this signature. The return value is not
* used. (The definition is set up to allow memcpy() and strlcpy() to be
* used directly.)
*/
typedef void *(*HashCopyFunc) (void *dest, const void *src, Size keysize);

According to the description, the keycopy function only copies the key, but
in reality it copies the entire entry, i.e., the key and the value, is the
name wrong? This may make the developer pass in an inappropriate keycopy
parameter when creating the htab.

Thanks

Reply via email to