package version up to 1.7.7
[platform/core/uifw/libtdm.git] / ut / stubs / stdlib_stubs.h
1 #ifndef _STDLIB_STUBS_H
2 #define _STDLIB_STUBS_H
3
4 #include <stdlib.h>
5 #include "tdm_list_stubs.h"
6 #include "tdm.h"
7 #include "tdm_private.h"
8
9 static int CALLOC_ERROR;
10 static int CALLOC_RETURN_BUFFER;
11 static int FREE_CALLED;
12
13 static tdm_buffer_info buffer;
14
15 static void *ut_calloc(size_t nmemb, size_t size)
16 {
17         if (CALLOC_ERROR) {
18                 return NULL;
19         }
20
21         if (CALLOC_RETURN_BUFFER) {
22                 return &buffer;
23         }
24
25         return calloc(nmemb, size);
26 }
27
28 static void ut_free(void *ptr)
29 {
30         FREE_CALLED = 1;
31         free(ptr);
32 }
33
34 #endif /* _STDLIB_STUBS_H */