summaryrefslogtreecommitdiff
path: root/legacy/eet/src/tests/eet_data_suite.c
blob: f6fb7f1100ecc7307211a893427e185bcc1527af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <string.h>
#include <stdio.h>

#include <Eina.h>

#include "eet_suite.h"

static char *
_eet_str_direct_alloc(const char * str)
{
   return (char *)str;
} /* _eet_str_direct_alloc */

static void
_eet_str_direct_free(const char * str)
{
   /* FIXME: Use attribute unused */
   (void)str;
} /* _eet_str_direct_free */

static void
_eet_eina_hash_foreach(void * hash, Eina_Hash_Foreach cb, void * fdata)
{
   if (hash)
      eina_hash_foreach(hash, cb, fdata);
} /* _eet_eina_hash_foreach */

/* Internal wrapper for eina_hash */
static Eina_Hash *
_eet_eina_hash_add(Eina_Hash * hash, const char * key, const void * data)
{
   if (!hash)
      hash = eina_hash_string_superfast_new(NULL);

   if (!hash)
      return NULL;

   eina_hash_add(hash, key, data);
   return hash;
} /* _eet_eina_hash_add */

static void
_eet_eina_hash_free(Eina_Hash * hash)
{
   if (hash)
      eina_hash_free(hash);
} /* _eet_eina_hash_free */

void
eet_test_setup_eddc(Eet_Data_Descriptor_Class * eddc)
{
   eddc->version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
   eddc->func.mem_alloc = NULL;
   eddc->func.mem_free = NULL;
   eddc->func.str_alloc = NULL;
   eddc->func.str_free = NULL;
   eddc->func.list_next = (void *)eina_list_next;
   eddc->func.list_append = (void *)eina_list_append;
   eddc->func.list_data = (void *)eina_list_data_get;
   eddc->func.list_free = (void *)eina_list_free;
   eddc->func.hash_foreach = (void *)_eet_eina_hash_foreach;
   eddc->func.hash_add = (void *)_eet_eina_hash_add;
   eddc->func.hash_free = (void *)_eet_eina_hash_free;
   eddc->func.str_direct_alloc = (void *)_eet_str_direct_alloc;
   eddc->func.str_direct_free = (void *)_eet_str_direct_free;
   eddc->func.array_alloc = NULL;
   eddc->func.array_free = NULL;
} /* eet_test_setup_eddc */