aboutsummaryrefslogtreecommitdiff
path: root/src/core/defs.h
diff options
context:
space:
mode:
authorGarrett D'Amore <garrett@damore.org>2017-01-02 11:26:43 -0800
committerGarrett D'Amore <garrett@damore.org>2017-01-02 11:26:43 -0800
commitc3d8e75f2bb76b5bfafc589f860036cf42cfbaa0 (patch)
tree44c6cf24785864b4b83adb0fad9ec2b51f67d862 /src/core/defs.h
parentb921ef8889a86cce42bca28950e33ba11d28d78f (diff)
downloadnng-c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0.tar.gz
nng-c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0.tar.bz2
nng-c3d8e75f2bb76b5bfafc589f860036cf42cfbaa0.zip
Use new NNI_ALLOC_STRUCT macro. nni_msg_dup copies options too.
Diffstat (limited to 'src/core/defs.h')
-rw-r--r--src/core/defs.h4
1 files changed, 4 insertions, 0 deletions
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