#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);
}
static void
_phone_book_stringshared_free_cb(void *data)
{
Phone_Entry *e = data;
free(e);
}
void *data,
{
Phone_Entry *e = data;
const char *name = e->name;
const char *number = e->number;
printf("%s: %s\n", name, number);
}
static void
example_hash_stringshared(void)
{
int i;
for (i = 0; _start_entries[i].name != NULL; i++)
{
Phone_Entry *e = malloc(sizeof(Phone_Entry));
}
printf("List of phones:\n");
printf("\n");
}
static unsigned int
_phone_book_string_key_length(const char *key)
{
if (!key)
return 0;
return (int)strlen(key) + 1;
}
static int
_phone_book_string_key_cmp(
const char *key1,
int key1_length
EINA_UNUSED,
{
return strcmp(key1, key2);
}
static void
example_hash_big(void)
{
int i;
const char *phone;
_phone_entry_free_cb,
10);
for (i = 0; _start_entries[i].name != NULL; i++)
{
strdup(_start_entries[i].number));
}
if (phone)
{
printf("Printing entry.\n");
printf("Name: Heitor Villa-Lobos\n");
printf("Number: %s\n\n", phone);
}
}
int
main(int argc, const char *argv[])
{
(void)argc;
(void)argv;
example_hash_stringshared();
example_hash_big();
}