diff options
Diffstat (limited to 'generic/tclInt.h')
-rw-r--r-- | generic/tclInt.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/generic/tclInt.h b/generic/tclInt.h index 4521ff4..cb72307 100644 --- a/generic/tclInt.h +++ b/generic/tclInt.h @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclInt.h,v 1.218 2005/04/01 16:18:59 msofer Exp $ + * RCS: @(#) $Id: tclInt.h,v 1.219 2005/04/02 02:08:37 msofer Exp $ */ #ifndef _TCLINT @@ -1618,20 +1618,34 @@ typedef enum TclEolTranslation { /* * The structure used as the internal representation of Tcl list - * objects. This is an array of pointers to the element objects. This array - * is grown (reallocated and copied) as necessary to hold all the list's - * element pointers. The array might contain more slots than currently used - * to hold all element pointers. This is done to make append operations - * faster. + * objects. This struct is grown (reallocated and copied) as necessary to hold + * all the list's element pointers. The struct might contain more slots than + * currently used to hold all element pointers. This is done to make append + * operations faster. */ typedef struct List { + int refCount; int maxElemCount; /* Total number of element array slots. */ int elemCount; /* Current number of list elements. */ - Tcl_Obj **elements; /* Array of pointers to element objects. */ + Tcl_Obj *elements; /* First list element; the struct is grown to + * accomodate all elements. */ } List; /* + * Macro used to get the elements of a list object - do NOT forget to verify + * that it is of list type before using! + */ + +#define TclListObjGetElements(listPtr, objc, objv) \ + { \ + List *listRepPtr = \ + (List *) (listPtr)->internalRep.twoPtrValue.ptr1;\ + (objc) = listRepPtr->elemCount;\ + (objv) = &listRepPtr->elements;\ + } + +/* *---------------------------------------------------------------- * Data structures related to the filesystem internals *---------------------------------------------------------------- |