summaryrefslogtreecommitdiffstats
path: root/src/resources/resource.h
blob: ada91fdb435d1b9cbbc22bdd3f82eb699c3b9915 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef RESOURCE_H
#define RESOURCE_H

struct resource_table {
	struct resource *head;
	struct resource *tail;
};
struct resource {
	char *path;
	int refs;
	struct resource *prev;
	struct resource *next;
};

extern inline void *resource_alloc(const char *path, size_t size);
struct resource *resource_get(struct resource_table *resources,
		const char *path);
void resource_add(struct resource_table *resources, const char *path,
		struct resource *new_res);
void resource_use(struct resource *resource);
int resource_free(struct resource_table *resources, struct resource *resource);

#endif