diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-24 13:47:43 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-24 13:47:43 +0200 |
commit | 2e0961e7251bb6a3135012475f2bdca010e2f93d (patch) | |
tree | 2b6d1b332e2db9d7a35089b50405478635e591ca /layer.h | |
parent | 35230b5fd1b96898d51372f92142e28bae13fb73 (diff) | |
download | osc-graphics-2e0961e7251bb6a3135012475f2bdca010e2f93d.tar.gz |
use BSD list macros instead of handwritten list primitives
luckily this works thanks to C++ classes being backward compatible to C structs
Diffstat (limited to 'layer.h')
-rw-r--r-- | layer.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -2,6 +2,7 @@ #define __HAVE_LAYER_H #include <string.h> +#include <bsd/sys/queue.h> #include <SDL.h> #include <SDL_thread.h> @@ -10,7 +11,7 @@ class Layer { SDL_mutex *mutex; public: - Layer *next; + SLIST_ENTRY(Layer) layers; char *name; @@ -43,7 +44,7 @@ public: }; class LayerList { - Layer *head; + SLIST_HEAD(layers_head, Layer) head; SDL_mutex *mutex; @@ -59,8 +60,9 @@ class LayerList { } public: - LayerList() : head(NULL) + LayerList() { + SLIST_INIT(&head); mutex = SDL_CreateMutex(); } ~LayerList() |