uthash

A hash for C structures
Download

uthash Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Troy D. Hanson
  • Publisher web site:

uthash Tags


uthash Description

A hash for C structures uthash is a hash for C structures, allowing any C structure having a unique key field to be hashed.Structures can be deleted, added or removed from the hash in constant time. The key field can have any data type.Example 1. Adding an item to a hash.#include "uthash.h"struct my_struct { int id; /* key */ char name; UT_hash_handle hh; /* makes this structure hashable */};struct my_struct *users = NULL;void add_user(struct my_struct *s) { HASH_ADD_INT( users, id, s ); /* hash, key field name, item */}Example 2. Looking up an item in a hash.struct my_struct *find_user(int user_id) { struct my_struct *s; HASH_FIND_INT( users, s, id, &user_id ); return s;}Example 1. Deleting an item from a hash.void delete_user(struct my_struct *user) { HASH_DEL( users, user); /* hash, pointer to deletee */} What's New in This Release: · This version includes a new live analysis utility (for Linux) to query the size and quality of hash tables in a running process. · Also included are support for Bloom filters which can speed up misses, re-inclusion of the MurmurHash hash function, and fixes to the companion linked list header.


uthash Related Software