X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fmacro.h;h=e7a4d2cde1940e531b113a0231a52c517bbf006d;hp=85a7fbccfdb4a8dd153780368859ebac08657047;hb=2006d9acb1248e4225d31c420520c043b1ae044d;hpb=9a60da2834074d970ca063c210fe9d2f05c70532 diff --git a/src/macro.h b/src/macro.h index 85a7fbccf..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)) @@ -47,13 +45,13 @@ #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]))