X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=include%2Futil.h;h=7c7b819a97269c6e8fcd5c0080839d156c3aae96;hb=501dc36b98c7e02cb799e0299216f8f95d45a18c;hp=0e48843cfb36b3d9f8f280749dddc464f0b51917;hpb=b87742172b3802badb615418f45d8556bfcf149b;p=i3%2Fi3 diff --git a/include/util.h b/include/util.h index 0e48843c..7c7b819a 100644 --- a/include/util.h +++ b/include/util.h @@ -30,6 +30,10 @@ for (Con *child = (Con*)-1; (child == (Con*)-1) && ((child = 0), true);) \ TAILQ_FOREACH(child, &((head)->nodes_head), nodes) +#define NODES_FOREACH_REVERSE(head) \ + for (Con *child = (Con*)-1; (child == (Con*)-1) && ((child = 0), true);) \ + TAILQ_FOREACH_REVERSE(child, &((head)->nodes_head), nodes_head, nodes) + /* greps the ->nodes of the given head and returns the first node that matches the given condition */ #define GREP_FIRST(dest, head, condition) \ NODES_FOREACH(head) { \ @@ -62,34 +66,6 @@ Rect rect_add(Rect a, Rect b); */ bool update_if_necessary(uint32_t *destination, const uint32_t new_value); -/** - * Safe-wrapper around malloc which exits if malloc returns NULL (meaning that - * there is no more memory available) - * - */ -void *smalloc(size_t size); - -/** - * Safe-wrapper around calloc which exits if malloc returns NULL (meaning that - * there is no more memory available) - * - */ -void *scalloc(size_t size); - -/** - * Safe-wrapper around realloc which exits if realloc returns NULL (meaning - * that there is no more memory available). - * - */ -void *srealloc(void *ptr, size_t size); - -/** - * Safe-wrapper around strdup which exits if malloc returns NULL (meaning that - * there is no more memory available) - * - */ -char *sstrdup(const char *str); - /** * Starts the given application by passing it through a shell. We use double * fork to avoid zombie processes. As the started application’s parent exits