Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.3 / 3....
  • LibreOffice 3.6.6 / 4.0.3
  • MPlayer 1.1.1
  • systemd 204
  • Arch Linux 2013.05.01
  • Blender 2.67a
  • KDE Software Compilatio...
  • CrunchBang Linux Stable...
  • Elementary OS 0.1 / 0.2...
  • SystemRescueCd 3.6.0
  • Home > Linux > Utilities

    uthash 1.9.7

    Download button

    Downloads: 1,071  Tell us about an update
    User Rating:
    Rated by:
    Good (3.0/5)
    9 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Troy D. Hanson | More programs
    BSD License / FREE
    October 9th, 2012, 23:49 GMT [view history]
    ROOT / Utilities

     Read user reviews (0)  Refer to a friend  Subscribe

    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[10];
    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 */
    }



    Product's homepage

    What's New in This Release: [ read full changelog ]

    · A number of small enhancements were made to the supplemental utilities included with uthash, including new list operations (prepend, replace, and support for structures that use different naming conventions), new dynamic string features (KMP substring search, format checking), compatibility improvements, and improved documentation.

      


    TAGS:

    C structures hash | unique key field | hashed keys | uthash | C+ | structures

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM