summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2017-01-24 12:42:37 -0800
committerH. Peter Anvin <hpa@zytor.com>2017-01-24 12:42:37 -0800
commit75f2c1e131a7651a793abc8f59aea09b6226ce7d (patch)
treefb67fccb0ed37e761c6be73e136c607d6e2d0577
parent5d7fdc1962ef9c5876c30b43b1b15cc9776c3655 (diff)
downloadnasm-75f2c1e131a7651a793abc8f59aea09b6226ce7d.tar.gz
Put in a comment that nasm_delete isn't side effect safe
I have not figured out a way to make nasm_delete() side effect safe without using compiler-specific hacks, which would defeat the whole purpose. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--include/nasmlib.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/nasmlib.h b/include/nasmlib.h
index e8342aac..218cf636 100644
--- a/include/nasmlib.h
+++ b/include/nasmlib.h
@@ -155,6 +155,10 @@ char * safe_alloc nasm_strndup(const char *, size_t);
#define nasm_new(p) ((p) = nasm_zalloc(sizeof(*(p))))
#define nasm_newn(p,n) ((p) = nasm_calloc(sizeof(*(p)),(n)))
+/*
+ * Careful: nasm_delete() is not side-effect safe.
+ * Any ideas how to fix that?
+ */
#define nasm_delete(p) do { nasm_free(p); (p) = NULL; } while (0)
#define nasm_zero(p) (memset((p), 0, sizeof(*(p))))