From bcc3814b58e9b198344bdaf6e7a916a354841275 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Fri, 3 Jan 2020 18:03:57 -0800 Subject: fixes #1104 move allocation of protocol objects to common core fixes #1103 respondent could inline backtrace --- src/core/defs.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/core/defs.h') diff --git a/src/core/defs.h b/src/core/defs.h index 9b7abafa..0e0deac2 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -134,6 +134,12 @@ typedef struct { // This increments a pointer a fixed number of byte cells. #define NNI_INCPTR(ptr, n) ((ptr) = (void *) ((char *) (ptr) + (n))) +// Alignment -- this is used when allocating adjacent objects to ensure +// that each object begins on a natural alignment boundary. +#define NNI_ALIGN_SIZE sizeof(void *) +#define NNI_ALIGN_MASK (NNI_ALIGN_SIZE - 1) +#define NNI_ALIGN_UP(sz) (((sz) + NNI_ALIGN_MASK) & ~NNI_ALIGN_MASK) + // A few assorted other items. #define NNI_FLAG_IPV4ONLY 1 -- cgit v1.2.3-70-g09d2