@@ -1090,6 +1090,26 @@ static const Tcl_ObjType v1TestListType = {
10901090};
10911091
10921092
1093+ static
1094+ void
1095+ HugeUpdateString (
1096+ TCL_UNUSED (Tcl_Obj * ))
1097+ {
1098+ /* Always returns NULL, as an indication that
1099+ * room for its string representation cannot be allocated */
1100+ return ;
1101+ }
1102+
1103+ static const Tcl_ObjType hugeType = {
1104+ "huge" , /* name */
1105+ NULL , /* freeIntRepProc */
1106+ NULL , /* dupIntRepProc */
1107+ HugeUpdateString , /* updateStringProc */
1108+ NULL , /* setFromAnyProc */
1109+ TCL_OBJTYPE_V0
1110+ };
1111+
1112+
10931113static int
10941114TestobjCmd (
10951115 TCL_UNUSED (void * ),
@@ -1104,14 +1124,14 @@ TestobjCmd(
11041124 static const char * const subcommands [] = {
11051125 "freeallvars" , "bug3598580" , "buge58d7e19e9" ,
11061126 "types" , "objtype" , "newobj" , "set" ,
1107- "assign" , "convert" , "duplicate" ,
1127+ "assign" , "convert" , "duplicate" , "huge" ,
11081128 "invalidateStringRep" , "refcount" , "type" ,
11091129 NULL
11101130 };
11111131 enum testobjCmdIndex {
11121132 TESTOBJ_FREEALLVARS , TESTOBJ_BUG3598580 , TESTOBJ_BUGE58D7E19E9 ,
11131133 TESTOBJ_TYPES , TESTOBJ_OBJTYPE , TESTOBJ_NEWOBJ , TESTOBJ_SET ,
1114- TESTOBJ_ASSIGN , TESTOBJ_CONVERT , TESTOBJ_DUPLICATE ,
1134+ TESTOBJ_ASSIGN , TESTOBJ_CONVERT , TESTOBJ_DUPLICATE , TESTOBJ_HUGE ,
11151135 TESTOBJ_INVALIDATESTRINGREP , TESTOBJ_REFCOUNT , TESTOBJ_TYPE ,
11161136 } cmdIndex ;
11171137
@@ -1208,7 +1228,17 @@ TestobjCmd(
12081228 }
12091229 SetVarToObj (varPtr , varIndex , objv [3 ]);
12101230 return TCL_OK ;
1211-
1231+ case TESTOBJ_HUGE : {
1232+ if (objc != 2 ) {
1233+ goto wrongNumArgs ;
1234+ }
1235+ Tcl_Obj * hugeObjPtr = Tcl_NewObj ();
1236+ hugeObjPtr -> typePtr = & hugeType ;
1237+ hugeObjPtr -> length = INT_MAX - 1 ;
1238+ hugeObjPtr -> bytes = NULL ;
1239+ Tcl_SetObjResult (interp , hugeObjPtr );
1240+ }
1241+ return TCL_OK ;
12121242 default :
12131243 break ;
12141244 }
0 commit comments