VgaGames 3 - Miscellaneous man-pages

[.. upper level ..]

VG3_hash_list()

Listing entries of a hash: return next key.
SYNTAX
const void * VG3_hash_list(void *vhash void **vpos, size_t *keysize)

FUNCTION PARAMETERS
vhash Hash
vpos For passing and returning actual position pointer
keysize Size of the key in bytes

RETURN VALUE
Returns next key.

DESCRIPTION
Listing entries of a hash: return next key. This function allows to iterate a hash until the position pointer vpos returns NULL.

EXAMPLE

Listing of a hash:
  void *hash = VG3_hash_new();
  void *vpos;
  const char *key;
  size_t keysize;

  [... setting hash ...]

  vpos = NULL;
  for (key = VG3_hash_list(hash, &vpos, &keysize); vpos != NULL; key = VG3_hash_list(hash, &vpos, &keysize)) {
    printf("- %.*s\n", (int)keysize, key);
    vpos = VG3_hash_del(hash, key, keysize);  // remove entry
  }

SEE ALSO
VG3_hash_new() VG3_hash_free() VG3_hash_set() VG3_hash_del() VG3_hash_clear() VG3_hash_isset() VG3_hash_get()