diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2011-05-09 15:24:06 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2011-05-09 15:24:06 (GMT) |
commit | 2ab84f74c362dd589f01ba696fde1b00d14fe1e5 (patch) | |
tree | 022fd34c553b4bac0b99b267538eecaeb5b0f116 /generic/tclTimer.c | |
parent | d15ccfa119985df6db333ac406e1f445d5b6d89f (diff) | |
download | tcl-2ab84f74c362dd589f01ba696fde1b00d14fe1e5.zip tcl-2ab84f74c362dd589f01ba696fde1b00d14fe1e5.tar.gz tcl-2ab84f74c362dd589f01ba696fde1b00d14fe1e5.tar.bz2 |
Reduce use of Tcl_AppendElement, which is not (and can't be) a Tcl_Obj-aware API.
Diffstat (limited to 'generic/tclTimer.c')
-rw-r--r-- | generic/tclTimer.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclTimer.c b/generic/tclTimer.c index 6682d21..cf91dca 100644 --- a/generic/tclTimer.c +++ b/generic/tclTimer.c @@ -793,7 +793,6 @@ Tcl_AfterObjCmd( AfterAssocData *assocPtr; int length; int index; - char buf[16 + TCL_INTEGER_SPACE]; static const char *const afterSubCmds[] = { "cancel", "idle", "info", NULL }; @@ -952,13 +951,16 @@ Tcl_AfterObjCmd( break; case AFTER_INFO: if (objc == 2) { + Tcl_Obj *resultObj = Tcl_NewObj(); + for (afterPtr = assocPtr->firstAfterPtr; afterPtr != NULL; afterPtr = afterPtr->nextPtr) { if (assocPtr->interp == interp) { - sprintf(buf, "after#%d", afterPtr->id); - Tcl_AppendElement(interp, buf); + Tcl_ListObjAppendElement(NULL, resultObj, Tcl_ObjPrintf( + "after#%d", afterPtr->id)); } } + Tcl_SetObjResult(interp, resultObj); return TCL_OK; } if (objc != 3) { |