summaryrefslogtreecommitdiffstats
path: root/generic/tclInt.h
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-04-18 18:50:41 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-04-18 18:50:41 (GMT)
commit66a254dddfb0c618ee609c6bfab4a6549e098772 (patch)
tree8d78f56622c7353be617d046b3586a18a8ca4ae1 /generic/tclInt.h
parent76259f2d58dc67f1a0095a1891696b69167c3902 (diff)
parent50920cb27bda1113bd1e4edf637f4a6d03c8d63a (diff)
downloadtcl-66a254dddfb0c618ee609c6bfab4a6549e098772.zip
tcl-66a254dddfb0c618ee609c6bfab4a6549e098772.tar.gz
tcl-66a254dddfb0c618ee609c6bfab4a6549e098772.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 29a9316..cf32e0d 100644
--- a/generic/tclInt.h
+++ b/generic/tclInt.h
@@ -2455,6 +2455,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)\
@@ -2465,6 +2468,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.