<i>Tcl_SetListObj fails reset obj properly</i> status still Open with 5 other changes
by
.
D 2001-03-30T01:58:05
J assignee dgp
J icomment Logged\sIn:\sYES\s\nuser_id=72656\n\nOK,\sit\slooks\slike\sthere\sare\sa\sfew\sthings\shere\sthat\scould\sbe\s\nfixed.\s\sThere\sis\sa\sbug,\sbut\sI\sthink\sthat\ssetting\slength\sto\s\n0\sis\sjust\sa\sband-aid.\s\sIn\sSetStringFromAny,\sthe\sreason\sit\s\nuses\sthe\sobjPtr->length\sis\sthat\sbytes\s!=\sNULL,\sWITHOUT\s\nchecking\sfor\sbytes\s==\stclEmptyStringRep\s(a\spseudo-\nequivalent)\swhich\sother\sprocs\sin\stclStringObj.c\smake\ssure\s\nto\sdo\s(also\sin\stclObj.c).\s\sSo,\syou\scould\sfix\s\nSetStringFromAny\sto\saccount\sfor\sthis\sjust\sas\s\nTcl_SetObjLength\sand\sothers\sdo.\n\nHowever,\swhat\smight\sbe\smore\sinteresting,\sand\shas\scome\sup\sin\s\ndiscussion\sbefore,\sis\swhy\san\sempty\slist\sisn't\sa\sTcl\slist\s\nobj.\s\sThe\sfollowing\sis\snot\strue:\n\n\s\s\sTcl_SetListObj(objPtr,\sobjc,\sobjv);\n\s\s\s/*\sThis\sfails\sfor\sobjc\s==\s0\s*/\n\s\s\sassert(objPtr->type\s==\s&tclListType);\n\nFrom\sbasic\stests,\syou\swouldn't\ssave\smuch\stime\strying\sto\s\navoid\sthat,\sbecause\sany\stclListType\smust\shave\sa\svalid\slist\s\nrep\s(which\smeans\san\salloc\sfor\san\sempty\slist).\n\nIt\sseems\sodd\sin\sany\scase\sthat\sTcl_SetListObj\swould\sjust\sset\s\nthe\sbytes\sto\stclEmptyStringRep\swhen\sthat\smeans\sanything\s\ndone\sto\sthe\sobject\swill\scause\sit\sto\sbecome\sa\sstring.\n\nAll\sin\sall,\sit\smight\sbe\seasiest\sto\sset\sthe\slength\sto\s0,\sand\s\nnote\sthat\sthat\sis\sequivalent\sto\sTclInitStringRep.\s\sIt\slooks\s\nto\sbe\sintentional\s(and\sin\sthe\sspirit\sof\sTcl)\sthat\sempty\s\nobjects\shave\sno\sparticular\stype\sto\sstart,\sand\sdon't\sget\sone\s\nuntil\syou\sdo\ssomething\swith\sit.\n
J login hobbs
J mimetype text/plain
J username hobbs
K 405998ffffffffffffffffffffffffffffffffff
U hobbs
Z 4d2f84c2d72ad01d575d6c9060787908