VSTa manual pages  - HASH_ALLOC (3)

NAME

hash_alloc - allocate a hash data structure

CONTENTS

Synopsis
Description
Return Value
See Also

SYNOPSIS

#include <hash.h>
struct hash *hash_alloc(int hashsize);

DESCRIPTION

The hash_alloc() function allocates a hash data structure of the size given by hashsize. For speed hashsize is always rounded to the nearest power of two above the requested size.
The hash struct contains the following fields:

struct hash {
    int h_hashsize;             /* Width of h_hash array */
    ulong h_hashmask;           /* Bit mask to match array size */
    struct hash_node            /* Chains under each hash value */
        *h_hash[1];
};

The hash_node struct in turn contains:

struct hash_node {
    struct hash_node *h_next;   /* Next on hash chain */
    long h_key;                 /* Key for this node */
    void *h_data;               /*  ...corresponding value */
};

The h_data pointer is then supposed to be pointed at your data.

RETURN VALUE

If it’s successfull it returns a pointer to a hash structure of the given size. If unsuccessfull it returns NULL.

SEE ALSO

hash_dealloc(3), hash_insert(3), hash_delete(3), hash_lookup(3), hash_foreach(3), hash_size(3)


HASH_ALLOC (3)
Generated by manServer 1.06 from hash_alloc.3 using man macros.