summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-20 21:32:35 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-09-20 21:32:35 (GMT)
commit9e43cbb9739ecfd05d38ff31a49050a0eb04505b (patch)
tree9f03fad624c027d190e47cb88ee31518a59d49e5 /generic/tclInt.h
parent7a56ff406f3244d777f60d9a5e0da1e5e08f3ef9 (diff)
downloadtcl-9e43cbb9739ecfd05d38ff31a49050a0eb04505b.zip
tcl-9e43cbb9739ecfd05d38ff31a49050a0eb04505b.tar.gz
tcl-9e43cbb9739ecfd05d38ff31a49050a0eb04505b.tar.bz2
Improve TclInvalidateStringRep() macro such that (objPtr) is only evaluated once. Addation brackets in TclHasStringRep() macro
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index 3dbffeb..f2f097c 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -4369,15 +4369,18 @@ MODULE_SCOPE void TclDbInitNewObj(Tcl_Obj *objPtr, const char *file,
*/
#define TclInvalidateStringRep(objPtr) \
- if (objPtr->bytes != NULL) { \
- if (objPtr->bytes != tclEmptyStringRep) { \
- ckfree((char *) objPtr->bytes); \
+ do { \
+ Tcl_Obj *_isobjPtr = (Tcl_Obj *)(objPtr); \
+ if (_isobjPtr->bytes != NULL) { \
+ if (_isobjPtr->bytes != tclEmptyStringRep) { \
+ ckfree((char *)_isobjPtr->bytes); \
+ } \
+ _isobjPtr->bytes = NULL; \
} \
- objPtr->bytes = NULL; \
- }
+ } while (0)
#define TclHasStringRep(objPtr) \
- (objPtr->bytes != NULL)
+ ((objPtr)->bytes != NULL)
/*
*----------------------------------------------------------------