summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-04-18 18:31:18 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-04-18 18:31:18 (GMT)
commit50920cb27bda1113bd1e4edf637f4a6d03c8d63a (patch)
treee3a65c3f98e799650f4c4afb7abef6c94662c81e /generic/tclInt.h
parentae1e62908f477136ea8d2d65e1c4b8603bccbd05 (diff)
downloadtcl-50920cb27bda1113bd1e4edf637f4a6d03c8d63a.zip
tcl-50920cb27bda1113bd1e4edf637f4a6d03c8d63a.tar.gz
tcl-50920cb27bda1113bd1e4edf637f4a6d03c8d63a.tar.bz2
Define and use macros that test whether a Tcl list value is canonical.
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r--generic/tclInt.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h
index b8a4dfa..ca565dd 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2207,6 +2207,9 @@ typedef struct List {
#define ListObjLength(listPtr, len) \
((len) = ListRepPtr(listPtr)->elemCount)
+#define ListObjIsCanonical(listPtr) \
+ (((listPtr)->bytes == NULL) || ListRepPtr(listPtr)->canonicalFlag)
+
#define TclListObjGetElements(interp, listPtr, objcPtr, objvPtr) \
(((listPtr)->typePtr == &tclListType) \
? ((ListObjGetElements((listPtr), *(objcPtr), *(objvPtr))), TCL_OK)\
@@ -2217,6 +2220,9 @@ typedef struct List {
? ((ListObjLength((listPtr), *(lenPtr))), TCL_OK)\
: Tcl_ListObjLength((interp), (listPtr), (lenPtr)))
+#define TclListObjIsCanonical(listPtr) \
+ (((listPtr)->typePtr == &tclListType) ? ListObjIsCanonical((listPtr)) : 0)
+
/*
* Macros providing a faster path to integers: Tcl_GetLongFromObj everywhere,
* Tcl_GetIntFromObj and TclGetIntForIndex on platforms where longs are ints.