diff options
author | dkf <dkf@noemail.net> | 2012-04-25 12:07:45 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2012-04-25 12:07:45 (GMT) |
commit | aa8b039f68c738c8d95123b049911587012273d2 (patch) | |
tree | 9287ec35f60eeed086288278741ae7b69817beda /generic/tclCmdAH.c | |
parent | 03429fd21440f06a3317b04e943d11ef84df4b87 (diff) | |
download | tcl-aa8b039f68c738c8d95123b049911587012273d2.zip tcl-aa8b039f68c738c8d95123b049911587012273d2.tar.gz tcl-aa8b039f68c738c8d95123b049911587012273d2.tar.bz2 |
* generic/tclUtil.c (TclDStringToObj): Added internal function to make
the fairly-common operation of converting a DString into an Obj a more
efficient one.
FossilOrigin-Name: 2e12143e3906901f7fe95b8ce11211f9310e741f
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r-- | generic/tclCmdAH.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 1cbc4d2..70aef8d 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -563,9 +563,7 @@ Tcl_EncodingObjCmd( * truncate the string at the first null byte. */ - Tcl_SetObjResult(interp, Tcl_NewStringObj( - Tcl_DStringValue(&ds), Tcl_DStringLength(&ds))); - Tcl_DStringFree(&ds); + Tcl_SetObjResult(interp, TclDStringToObj(&ds)); } else { /* * Store the result as binary data. @@ -1869,20 +1867,16 @@ PathNativeNameCmd( int objc, Tcl_Obj *const objv[]) { - const char *fileName; Tcl_DString ds; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "name"); return TCL_ERROR; } - fileName = Tcl_TranslateFileName(interp, TclGetString(objv[1]), &ds); - if (fileName == NULL) { + if (Tcl_TranslateFileName(interp, TclGetString(objv[1]), &ds) == NULL) { return TCL_ERROR; } - Tcl_SetObjResult(interp, Tcl_NewStringObj(fileName, - Tcl_DStringLength(&ds))); - Tcl_DStringFree(&ds); + Tcl_SetObjResult(interp, TclDStringToObj(&ds)); return TCL_OK; } |