svn update: 51457 (latest:51480)
[framework/uifw/eet.git] / src / tests / eet_data_suite.c
1 #include <string.h>
2 #include <stdio.h>
3
4 #include <Eina.h>
5
6 #include "eet_suite.h"
7
8 static char *
9 _eet_str_direct_alloc(const char * str)
10 {
11    return (char *)str;
12 } /* _eet_str_direct_alloc */
13
14 static void
15 _eet_str_direct_free(const char * str)
16 {
17    /* FIXME: Use attribute unused */
18    (void)str;
19 } /* _eet_str_direct_free */
20
21 static void
22 _eet_eina_hash_foreach(void * hash, Eina_Hash_Foreach cb, void * fdata)
23 {
24    if (hash)
25       eina_hash_foreach(hash, cb, fdata);
26 } /* _eet_eina_hash_foreach */
27
28 /* Internal wrapper for eina_hash */
29 static Eina_Hash *
30 _eet_eina_hash_add(Eina_Hash * hash, const char * key, const void * data)
31 {
32    if (!hash)
33       hash = eina_hash_string_superfast_new(NULL);
34
35    if (!hash)
36       return NULL;
37
38    eina_hash_add(hash, key, data);
39    return hash;
40 } /* _eet_eina_hash_add */
41
42 static void
43 _eet_eina_hash_free(Eina_Hash * hash)
44 {
45    if (hash)
46       eina_hash_free(hash);
47 } /* _eet_eina_hash_free */
48
49 void
50 eet_test_setup_eddc(Eet_Data_Descriptor_Class * eddc)
51 {
52    eddc->version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
53    eddc->func.mem_alloc = NULL;
54    eddc->func.mem_free = NULL;
55    eddc->func.str_alloc = NULL;
56    eddc->func.str_free = NULL;
57    eddc->func.list_next = (void *)eina_list_next;
58    eddc->func.list_append = (void *)eina_list_append;
59    eddc->func.list_data = (void *)eina_list_data_get;
60    eddc->func.list_free = (void *)eina_list_free;
61    eddc->func.hash_foreach = (void *)_eet_eina_hash_foreach;
62    eddc->func.hash_add = (void *)_eet_eina_hash_add;
63    eddc->func.hash_free = (void *)_eet_eina_hash_free;
64    eddc->func.str_direct_alloc = (void *)_eet_str_direct_alloc;
65    eddc->func.str_direct_free = (void *)_eet_str_direct_free;
66    eddc->func.array_alloc = NULL;
67    eddc->func.array_free = NULL;
68 } /* eet_test_setup_eddc */
69