summaryrefslogtreecommitdiffstats
path: root/generic/tclZlib.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-07-03 14:52:55 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-07-03 14:52:55 (GMT)
commit08bec1c1e8e4aae5cb45d4c68a2ab5d9bd73470e (patch)
tree84118ecaa9257d1f2e99228c0ae52bc98d574b97 /generic/tclZlib.c
parenta70bdc9ec1f2e2009feff998bb7ceb63dd28cb90 (diff)
downloadtcl-08bec1c1e8e4aae5cb45d4c68a2ab5d9bd73470e.zip
tcl-08bec1c1e8e4aae5cb45d4c68a2ab5d9bd73470e.tar.gz
tcl-08bec1c1e8e4aae5cb45d4c68a2ab5d9bd73470e.tar.bz2
Factor out a number of common patterns of use of Tcl_DStringAppend.
Diffstat (limited to 'generic/tclZlib.c')
-rw-r--r--generic/tclZlib.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/generic/tclZlib.c b/generic/tclZlib.c
index b970b3d..a799639 100644
--- a/generic/tclZlib.c
+++ b/generic/tclZlib.c
@@ -573,9 +573,8 @@ Tcl_ZlibStreamInit(
goto error;
}
Tcl_DStringInit(&cmdname);
- Tcl_DStringAppend(&cmdname, "::tcl::zlib::streamcmd_", -1);
- Tcl_DStringAppend(&cmdname, Tcl_GetString(Tcl_GetObjResult(interp)),
- -1);
+ TclDStringAppendLiteral(&cmdname, "::tcl::zlib::streamcmd_");
+ TclDStringAppendObj(&cmdname, Tcl_GetObjResult(interp));
if (Tcl_GetCommandInfo(interp, Tcl_DStringValue(&cmdname),
&cmdinfo) == 1) {
Tcl_SetResult(interp,
@@ -2695,10 +2694,7 @@ ZlibTransformGetOption(
Tcl_DStringAppendElement(dsPtr, Tcl_GetString(tmpObj));
Tcl_DecrRefCount(tmpObj);
} else {
- int len;
- const char *str = Tcl_GetStringFromObj(tmpObj, &len);
-
- Tcl_DStringAppend(dsPtr, str, len);
+ TclDStringAppendObj(dsPtr, tmpObj);
Tcl_DecrRefCount(tmpObj);
return TCL_OK;
}
@@ -3022,7 +3018,7 @@ ResultCopy(
*/
memcpy(buf, Tcl_DStringValue(&cd->decompressed), have);
- Tcl_DStringSetLength(&cd->decompressed, 0);
+ TclDStringClear(&cd->decompressed);
return have;
}
}