]> git.sur5r.net Git - i3/i3/blob - include/libi3.h
a675d11ed41139db7944b581f3d5cfb44ef0acdc
[i3/i3] / include / libi3.h
1 /*
2  * vim:ts=4:sw=4:expandtab
3  */
4
5 #ifndef _LIBI3_H
6 #define _LIBI3_H
7
8 /**
9  * Try to get the socket path from X11 and return NULL if it doesn’t work.
10  *
11  * The memory for the socket path is dynamically allocated and has to be
12  * free()d by the caller.
13  *
14  */
15 char *socket_path_from_x11();
16
17 /**
18  * Safe-wrapper around malloc which exits if malloc returns NULL (meaning that
19  * there is no more memory available)
20  *
21  */
22 void *smalloc(size_t size);
23
24 /**
25  * Safe-wrapper around calloc which exits if malloc returns NULL (meaning that
26  * there is no more memory available)
27  *
28  */
29 void *scalloc(size_t size);
30
31 /**
32  * Safe-wrapper around realloc which exits if realloc returns NULL (meaning
33  * that there is no more memory available).
34  *
35  */
36 void *srealloc(void *ptr, size_t size);
37
38 /**
39  * Safe-wrapper around strdup which exits if malloc returns NULL (meaning that
40  * there is no more memory available)
41  *
42  */
43 char *sstrdup(const char *str);
44
45 #endif