summaryrefslogtreecommitdiffstats
path: root/Macros.h
diff options
context:
space:
mode:
authorChristian Göttsche <cgzones@googlemail.com>2021-03-21 19:40:56 +0100
committercgzones <cgzones@googlemail.com>2021-04-14 17:29:56 +0200
commit9a8221568ada269d20c3e9d291ad5f9d07cac755 (patch)
tree025f098f3e98e3ae27105feb60dc76d4ff627452 /Macros.h
parent36880cd61c52f13c6fd284aa23d42d9493d3ab2e (diff)
Rework TTY column
* Rename internal identifier from TTY_NR to just TTY * Unify column header on platforms * Use devname(3) on BSD derivate to show the actual terminal, simplifies current FreeBSD implementation. * Use 'unsigned long int' as id type, to fit dev_t on Linux. Only on Solaris the terminal path is not yet resolved.
Diffstat (limited to 'Macros.h')
-rw-r--r--Macros.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/Macros.h b/Macros.h
index 736d31c5..789b09b6 100644
--- a/Macros.h
+++ b/Macros.h
@@ -4,27 +4,31 @@
#include <assert.h> // IWYU pragma: keep
#ifndef MINIMUM
-#define MINIMUM(a, b) ((a) < (b) ? (a) : (b))
+#define MINIMUM(a, b) ((a) < (b) ? (a) : (b))
#endif
#ifndef MAXIMUM
-#define MAXIMUM(a, b) ((a) > (b) ? (a) : (b))
+#define MAXIMUM(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef CLAMP
-#define CLAMP(x, low, high) (assert((low) <= (high)), ((x) > (high)) ? (high) : MAXIMUM(x, low))
+#define CLAMP(x, low, high) (assert((low) <= (high)), ((x) > (high)) ? (high) : MAXIMUM(x, low))
#endif
#ifndef ARRAYSIZE
-#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
+#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
#ifndef SPACESHIP_NUMBER
-#define SPACESHIP_NUMBER(a, b) (((a) > (b)) - ((a) < (b)))
+#define SPACESHIP_NUMBER(a, b) (((a) > (b)) - ((a) < (b)))
#endif
#ifndef SPACESHIP_NULLSTR
-#define SPACESHIP_NULLSTR(a, b) strcmp((a) ? (a) : "", (b) ? (b) : "")
+#define SPACESHIP_NULLSTR(a, b) strcmp((a) ? (a) : "", (b) ? (b) : "")
+#endif
+
+#ifndef SPACESHIP_DEFAULTSTR
+#define SPACESHIP_DEFAULTSTR(a, b, s) strcmp((a) ? (a) : (s), (b) ? (b) : (s))
#endif
#ifdef __GNUC__ // defined by GCC and Clang

© 2014-2024 Faster IT GmbH | imprint | privacy policy