]> git.sur5r.net Git - i3/i3/blobdiff - include/util.h
move sstrdup, scalloc, smalloc, srealloc to libi3, improve error messages
[i3/i3] / include / util.h
index 0e48843cfb36b3d9f8f280749dddc464f0b51917..7c7b819a97269c6e8fcd5c0080839d156c3aae96 100644 (file)
     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