diff options
author | nijtmans <nijtmans> | 2008-11-26 23:44:59 (GMT) |
---|---|---|
committer | nijtmans <nijtmans> | 2008-11-26 23:44:59 (GMT) |
commit | af5fd80ac65755d299d93e203c672f974594e42d (patch) | |
tree | 3693d2226bdadfa3c4b898adc8ab466399f37b61 /generic/tclTest.c | |
parent | 12370b2c306d55d85724b508ddc18bf631b9d46a (diff) | |
download | tcl-af5fd80ac65755d299d93e203c672f974594e42d.zip tcl-af5fd80ac65755d299d93e203c672f974594e42d.tar.gz tcl-af5fd80ac65755d299d93e203c672f974594e42d.tar.bz2 |
A few more (harmless) Tcl_SetResult eliminations
Diffstat (limited to 'generic/tclTest.c')
-rw-r--r-- | generic/tclTest.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/generic/tclTest.c b/generic/tclTest.c index 1093d8c..f93857a 100644 --- a/generic/tclTest.c +++ b/generic/tclTest.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclTest.c,v 1.132 2008/11/25 06:48:01 nijtmans Exp $ + * RCS: @(#) $Id: tclTest.c,v 1.133 2008/11/26 23:44:59 nijtmans Exp $ */ #define TCL_TEST @@ -743,7 +743,6 @@ TestasyncCmd( TestAsyncHandler *asyncPtr, *prevPtr; int id, code; static int nextId = 1; - char buf[TCL_INTEGER_SPACE]; if (argc < 2) { wrongNumArgs: @@ -763,8 +762,7 @@ TestasyncCmd( strcpy(asyncPtr->command, argv[2]); asyncPtr->nextPtr = firstHandler; firstHandler = asyncPtr; - TclFormatInt(buf, asyncPtr->id); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewIntObj(asyncPtr->id)); } else if (strcmp(argv[1], "delete") == 0) { if (argc == 2) { while (firstHandler != NULL) { @@ -812,7 +810,7 @@ TestasyncCmd( break; } } - Tcl_SetResult(interp, (char *)argv[3], TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewStringObj(argv[3], -1)); return code; #ifdef TCL_THREADS } else if (strcmp(argv[1], "marklater") == 0) { @@ -985,9 +983,9 @@ TestcmdinfoCmd( info.deleteProc = CmdDelProc2; info.deleteData = (ClientData) "new_delete_data"; if (Tcl_SetCommandInfo(interp, argv[2], &info) == 0) { - Tcl_SetResult(interp, "0", TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewIntObj(0)); } else { - Tcl_SetResult(interp, "1", TCL_STATIC); + Tcl_SetObjResult(interp, Tcl_NewIntObj(1)); } } else { Tcl_AppendResult(interp, "bad option \"", argv[1], @@ -1651,13 +1649,11 @@ TestdstringCmd( } Tcl_DStringGetResult(interp, &dstring); } else if (strcmp(argv[1], "length") == 0) { - char buf[TCL_INTEGER_SPACE]; if (argc != 2) { goto wrongNumArgs; } - TclFormatInt(buf, Tcl_DStringLength(&dstring)); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewIntObj(Tcl_DStringLength(&dstring))); } else if (strcmp(argv[1], "result") == 0) { if (argc != 2) { goto wrongNumArgs; @@ -4893,7 +4889,7 @@ TestsaveresultCmd( break; } case RESULT_DYNAMIC: - Tcl_SetResult(interp, "dynamic result", TestsaveresultFree); + Tcl_SetResult(interp, (char *)"dynamic result", TestsaveresultFree); break; case RESULT_OBJECT: objPtr = Tcl_NewStringObj("object result", -1); @@ -6528,7 +6524,6 @@ TestgetintCmd( return TCL_ERROR; } else { int val, i, total=0; - char buf[TCL_INTEGER_SPACE]; for (i=1 ; i<argc ; i++) { if (Tcl_GetInt(interp, argv[i], &val) != TCL_OK) { @@ -6536,8 +6531,7 @@ TestgetintCmd( } total += val; } - TclFormatInt(buf, total); - Tcl_SetResult(interp, buf, TCL_VOLATILE); + Tcl_SetObjResult(interp, Tcl_NewIntObj(total)); return TCL_OK; } } |