#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);
}
 
{
   const char *name = key;
   const char *number = data;
   printf("%s: %s\n", name, number);
 
   
}
 
int
main(int argc, const char *argv[])
{
   (void) argc;
   (void) argv;
   int i;
   const char *entry_name = "Heitor Villa-Lobos";
   char *phone = NULL;
   void *data;
 
 
 
   
   for (i = 0; _start_entries[i].name != NULL; i++)
     {
                      strdup(_start_entries[i].number));
     }
 
   
   if (phone)
     {
        printf("Printing entry.\n");
        printf("Name: %s\n", entry_name);
        printf("Number: %s\n\n", phone);
     }
 
   
   printf("Hash entry successfully deleted? %d\n\n", r);
 
   
                            strdup("+23 45 111-11111"));
   free(phone);
 
   
   
                         strdup("+55 01 234-56789"));
   if (!phone)
     {
        printf("No previous phone found for Raul Seixas. ");
        printf("Creating new entry.\n");
     }
   else
     {
        printf("Old phone for Raul Seixas was %s\n", phone);
        free(phone);
     }
 
   printf("\n");
 
   
                         strdup("+55 02 222-22222"));
   if (phone)
     {
        printf("Changing phone for Raul Seixas to +55 02 222-22222. ");
        printf("Old phone was %s\n", phone);
        free(phone);
     }
   else
     {
        printf("No previous phone found for Raul Seixas. ");
        printf("Creating new entry.\n");
     }
 
   
   
   printf("List of phones:\n");
   printf("\n");
 
   
   printf("List of phones:\n");
     {
        const char *name = t->key;
        const char *number = t->data;
        printf("%s: %s\n", name, number);
     }
   printf("\n");
 
   
   printf("List of names in the phone book:\n");
     {
        const char *name = data;
        printf("%s\n", name);
     }
   printf("\n");
 
   
   printf("List of numbers in the phone book:\n");
     {
        const char *number = data;
        printf("%s\n", number);
     }
   printf("\n");
 
   
   printf("There are %d items in the hash.\n\n",
 
   
   printf("List of phones after change:\n");
   printf("\n");
 
   
   printf("There are %d items in the hash.\n\n",
 
   
   
 
}
Eina_Iterator * eina_hash_iterator_key_new(const Eina_Hash *hash)
Returns a new iterator associated with hash keys.
Definition: eina_hash.c:1272
void eina_hash_foreach(const Eina_Hash *hash, Eina_Hash_Foreach func, const void *fdata)
Calls a function on every member stored in the hash table.
Definition: eina_hash.c:1223
void * eina_hash_find(const Eina_Hash *hash, const void *key)
Retrieves a specific entry in the given hash table.
Definition: eina_hash.c:1069
Eina_Iterator * eina_hash_iterator_data_new(const Eina_Hash *hash)
Returns a new iterator associated with a hash.
Definition: eina_hash.c:1246
void * eina_hash_set(Eina_Hash *hash, const void *key, const void *data)
Modifies the entry pointer at the specified key and returns the previous entry or adds the entry if n...
Definition: eina_hash.c:1121
int eina_hash_population(const Eina_Hash *hash)
Returns the number of entries in the given hash table.
Definition: eina_hash.c:858
struct _Eina_Hash Eina_Hash
Type for a generic hash table.
Definition: eina_hash.h:285
Eina_Bool eina_hash_move(Eina_Hash *hash, const void *old_key, const void *new_key)
Changes the key of an entry in a hash without triggering the free callback.
Definition: eina_hash.c:1191
void * eina_hash_modify(Eina_Hash *hash, const void *key, const void *data)
Modifies the entry pointer at the specified key and returns the previous entry.
Definition: eina_hash.c:1174
void eina_hash_free_buckets(Eina_Hash *hash)
Frees the given hash table buckets resources.
Definition: eina_hash.c:886
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_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
void eina_hash_free(Eina_Hash *hash)
Frees the given hash table's resources.
Definition: eina_hash.c:868
Eina_Iterator * eina_hash_iterator_tuple_new(const Eina_Hash *hash)
Returned a new iterator associated with hash keys and data.
Definition: eina_hash.c:1299
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_Bool eina_iterator_next(Eina_Iterator *iterator, void **data)
Returns the value of the current element and go to the next one.
Definition: eina_iterator.c:118
void eina_iterator_free(Eina_Iterator *iterator)
Frees an iterator.
Definition: eina_iterator.c:98
int eina_shutdown(void)
Shuts down the Eina library.
Definition: eina_main.c:350
int eina_init(void)
Initializes the Eina library.
Definition: eina_main.c:279
#define EINA_TRUE
boolean value TRUE (numerical value 1)
Definition: eina_types.h:539
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
Data for a hash table of key/value pairs.
Definition: eina_hash.h:298
structure of an iterator
Definition: eina_iterator.h:159