diff options
Diffstat (limited to 'src/resources/resource.h')
-rw-r--r-- | src/resources/resource.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/resources/resource.h b/src/resources/resource.h new file mode 100644 index 0000000..ada91fd --- /dev/null +++ b/src/resources/resource.h @@ -0,0 +1,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 |