X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fmacro.h;h=e7a4d2cde1940e531b113a0231a52c517bbf006d;hp=b3da60f13e51e926c967c5c07c0222080861a801;hb=9e37286844f67ca7c59e923dd27ad193dfdda7eb;hpb=3b63d2d31d0850bd7a81ab9b468218d2c4c461e8 diff --git a/src/macro.h b/src/macro.h index b3da60f13..e7a4d2cde 100644 --- a/src/macro.h +++ b/src/macro.h @@ -27,8 +27,6 @@ #include #include -#define PAGE_SIZE 4096 - #define _printf_attr_(a,b) __attribute__ ((format (printf, a, b))) #define _sentinel_ __attribute__ ((sentinel)) #define _noreturn_ __attribute__((noreturn)) @@ -45,14 +43,15 @@ #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) { - return ((l + sizeof(void*) - 1) & ~(sizeof(void*) - 1)); -} +#define XSTRINGIFY(x) #x +#define STRINGIFY(x) XSTRINGIFY(x) -static inline size_t PAGE_ALIGN(size_t l) { - return ((l + PAGE_SIZE - 1) & ~(PAGE_SIZE -1)); +/* Rounds up */ +#define ALIGN(l) ALIGN_TO((l), sizeof(void*)) +static inline size_t ALIGN_TO(size_t l, size_t ali) { + return ((l + ali - 1) & ~(ali - 1)); } #define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))