X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fmacro.h;h=85a7fbccfdb4a8dd153780368859ebac08657047;hb=0736af98c6fae9c7d31e3dd17589421b7e883ef5;hp=12ccbb151341684f6e3f09d9b8a05da6d44d3c00;hpb=22be093ffb403a1c474037939ca9b88b1ee39f77;p=elogind.git diff --git a/src/macro.h b/src/macro.h index 12ccbb151..85a7fbccf 100644 --- a/src/macro.h +++ b/src/macro.h @@ -45,6 +45,7 @@ #define _public_ __attribute__ ((visibility("default"))) #define _hidden_ __attribute__ ((visibility("hidden"))) #define _weakref_(x) __attribute__((weakref(#x))) +#define _introspect_(x) __attribute__((section("introspect." x))) /* Rounds up */ static inline size_t ALIGN(size_t l) { @@ -57,19 +58,29 @@ static inline size_t PAGE_ALIGN(size_t l) { #define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0])) +#ifndef MAX #define MAX(a,b) \ __extension__ ({ \ typeof(a) _a = (a); \ typeof(b) _b = (b); \ _a > _b ? _a : _b; \ }) +#endif + +#define MAX3(a,b,c) \ + MAX(MAX(a,b),c) +#ifndef MIN #define MIN(a,b) \ __extension__ ({ \ typeof(a) _a = (a); \ typeof(b) _b = (b); \ _a < _b ? _a : _b; \ }) +#endif + +#define MIN3(a,b,c) \ + MIN(MIN(a,b),c) #define CLAMP(x, low, high) \ __extension__ ({ \