#include <stdio.h>
#include <string.h>
struct _Phone_Entry {
const char *name;
const char *number;
};
typedef struct _Phone_Entry Phone_Entry;
static Phone_Entry _start_entries[] = {
{ "Wolfgang Amadeus Mozart", "+01 23 456-78910" },
{ "Ludwig van Beethoven", "+12 34 567-89101" },
{ "Richard Georg Strauss", "+23 45 678-91012" },
{ "Heitor Villa-Lobos", "+34 56 789-10123" },
{ NULL, NULL }
};
static void
_phone_entry_free_cb(void *data)
{
free(data);
}
int
{
int i;
const char *entry_name = "Heitor Villa-Lobos";
int entry_size;
const char *saved_entry_name = "Alceu Valenca";
int saved_entry_size = sizeof("Alceu Valenca");
const char *phone = NULL;
for (i = 0; _start_entries[i].name != NULL; i++)
{
strdup(_start_entries[i].number));
}
printf("Hash entry successfully deleted? %d\n\n", r);
sizeof("Ludwig van Beethoven"));
sizeof("Ludwig van Beethoven"), hash);
printf("Hash entry successfully deleted? %d\n\n", r);
printf("Hash entry successfully deleted? %d\n\n", r);
entry_name = "Raul_Seixas";
entry_size = sizeof("Raul Seixas");
phone = strdup("+33 33 333-33333");
printf("Hash entry successfully deleted? %d\n\n", r);
phone = strdup("+44 44 444-44444");
saved_entry_size, hash, phone);
saved_entry_size, hash);
if (phone)
{
char *newphone = strdup("+55 55 555-55555");
saved_entry_size, hash, newphone);
if (phone)
printf("changing phone to %s, old one was %s\n", newphone, phone);
else
printf("couldn't modify entry identified by %d\n", hash);
}
else
{
printf("couldn't find entry identified by %d\n", hash);
}
}
EINA_API int eina_hash_superfast(const char *key, int len)
Paul Hsieh (http://www.azillionmonkeys.com/qed/hash.html) hash function used by WebCore (http://webki...
Definition: eina_hash.c:1330
EINA_API Eina_Bool eina_hash_del(Eina_Hash *hash, const void *key, const void *data)
Removes the entry identified by a key or a data from the given hash table.
Definition: eina_hash.c:1030
EINA_API Eina_Bool eina_hash_direct_add_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash, const void *data)
Adds an entry to a hash table by its key hash without duplicating the string key.
Definition: eina_hash.c:921
EINA_API Eina_Bool eina_hash_add(Eina_Hash *hash, const void *key, const void *data)
Adds an entry to the given hash table.
Definition: eina_hash.c:931
EINA_API void eina_hash_free(Eina_Hash *hash)
Frees the given hash table's resources.
Definition: eina_hash.c:868
struct _Eina_Hash Eina_Hash
Type for a generic hash table.
Definition: eina_hash.h:285
EINA_API void * eina_hash_modify_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash, const void *data)
Modifies the entry pointer at the specified key and returns the previous entry.
Definition: eina_hash.c:1090
EINA_API Eina_Hash * eina_hash_string_superfast_new(Eina_Free_Cb data_free_cb)
Creates a new hash table for use with strings.
Definition: eina_hash.c:790
EINA_API void * eina_hash_find_by_hash(const Eina_Hash *hash, const void *key, int key_length, int key_hash)
Retrieves a specific entry from the given hash table.
Definition: eina_hash.c:1042
EINA_API Eina_Bool eina_hash_del_by_data(Eina_Hash *hash, const void *data)
Removes an entry from a hash table identified by its data value.
Definition: eina_hash.c:986
EINA_API Eina_Bool eina_hash_add_by_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash, const void *data)
Adds an entry to the given hash table by its key hash.
Definition: eina_hash.c:906
EINA_API Eina_Bool eina_hash_del_by_key(Eina_Hash *hash, const void *key)
Removes the entry identified by a key from the given hash table.
Definition: eina_hash.c:977
EINA_API Eina_Bool eina_hash_del_by_key_hash(Eina_Hash *hash, const void *key, int key_length, int key_hash)
Removes the entry identified by a key and a key hash from the given hash table.
Definition: eina_hash.c:965
EINA_API int eina_shutdown(void)
Shuts down the Eina library.
Definition: eina_main.c:379
EINA_API int eina_init(void)
Initializes the Eina library.
Definition: eina_main.c:291
unsigned char Eina_Bool
Type to mimic a boolean.
Definition: eina_types.h:527
#define EINA_UNUSED
Used to indicate that a function parameter is purposely unused.
Definition: eina_types.h:339