]> git.sur5r.net Git - i3/i3/blobdiff - i3bar/include/util.h
Merge branch 'master' into next
[i3/i3] / i3bar / include / util.h
index 6094932071ec299aed1af14f9fe29d8ec468e44a..9ffd4467f56ceb3f5078e0432b0c569dd3565b60 100644 (file)
@@ -1,20 +1,22 @@
 /*
- * i3bar - an xcb-based status- and ws-bar for i3
+ * vim:ts=4:sw=4:expandtab
  *
- * © 2010-2011 Axel Wagner and contributors
- *
- * See file LICNSE for license information
+ * i3 - an improved dynamic tiling window manager
+ * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
  *
  */
-#ifndef UTIL_H_
-#define UTIL_H_
+#pragma once
 
 #include "queue.h"
 
 /* Get the maximum/minimum of x and y */
+#undef MAX
 #define MAX(x,y) ((x) > (y) ? (x) : (y))
+#undef MIN
 #define MIN(x,y) ((x) < (y) ? (x) : (y))
 
+#define STARTS_WITH(string, len, needle) ((len >= strlen(needle)) && strncasecmp(string, needle, strlen(needle)) == 0)
+
 /* Securely free p */
 #define FREE(p) do { \
     if (p != NULL) { \
@@ -33,8 +35,6 @@
     } \
 } while (0)
 
-#endif
-
 /* Securely fee tail-queues */
 #define FREE_TAILQ(l, type) do { \
     type *walk = TAILQ_FIRST(l); \
@@ -45,6 +45,9 @@
     } \
 } while (0)
 
+#if defined(DLOG)
+#undef DLOG
+#endif
 /* Use cool logging-macros */
 #define DLOG(fmt, ...) do { \
     if (config.verbose) { \
     } \
 } while(0)
 
+/* We will include libi3.h which define its own version of ELOG.
+ * We want *our* version, so we undef the libi3 one. */
+#if defined(ELOG)
+#undef ELOG
+#endif
 #define ELOG(fmt, ...) do { \
     fprintf(stderr, "[%s:%d] ERROR: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
 } while(0)