From c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0 Mon Sep 17 00:00:00 2001 From: Garrett D'Amore Date: Mon, 2 Jan 2017 11:26:43 -0800 Subject: Use new NNI_ALLOC_STRUCT macro. nni_msg_dup copies options too. --- src/core/defs.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/core/defs.h') diff --git a/src/core/defs.h b/src/core/defs.h index 9687215d..0fe894b1 100644 --- a/src/core/defs.h +++ b/src/core/defs.h @@ -39,4 +39,8 @@ typedef int64_t nni_duration; // Relative time (usec). #define NNI_TIME_ZERO ((nni_time) 0) #define NNI_SECOND (1000000) +// Structure allocation conveniences. +#define NNI_ALLOC_STRUCT(s) nni_alloc(sizeof (*(s))) +#define NNI_FREE_STRUCT(s) nni_free((s), sizeof (*(s))) + #endif // CORE_DEFS_H -- cgit v1.2.3-70-g09d2