blob: 69baed971a358f863a51a261f8a7dc0ee7e80bf0 (
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
|
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "data_store.h"
static data_store_t *d = NULL;
/**
* Returns pointer to global data_store object.
* Creates it at first call.
* @return Pointer to global data_store
*/
data_store_t* data_store(void)
{
if(!d)
{
d = malloc(sizeof(data_store_t));
memset(d, 0, sizeof(data_store_t));
}
return d;
}
/**
* Free memory of global data_store
*/
void destroy_data_store(void)
{
free(d);
d = NULL;
}
|