-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.h
More file actions
29 lines (23 loc) · 768 Bytes
/
Copy pathutils.h
File metadata and controls
29 lines (23 loc) · 768 Bytes
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
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define bounds(a, b, c) min(c, max(a, b))
#define img_init(id) \
XCreateBitmapFromData(context->display, context->root, (char*)id##_bits, id##_width, id##_height)
#define alen(a) (sizeof(a) / sizeof(a[0]))
char* read_string(const char* path);
int read_int(const char* path);
void detach(const char* path);
void fatal(const char* message, const char* error);
struct list_entry
{
struct list_entry* next;
void* data;
};
void list_add(struct list_entry** head, void* data);
// TODO: Looks ugly, revisit later
#define for_each(type_name, entry, body) \
for (struct list_entry* copy = entry; copy; copy = copy->next) \
{ \
type_name = copy->data; \
body; \
}