diff options
author | dgp <dgp@noemail.net> | 2005-07-05 21:18:13 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2005-07-05 21:18:13 (GMT) |
commit | 9c33b6a4755352a1df122cea720c32999a548bdf (patch) | |
tree | b66ee0bc1d9995dfd54be7ef3fa6d9d8a30024ac /generic/tclCmdAH.c | |
parent | 78219a1b595b0a2959d3525cd0691a2125a1a358 (diff) | |
download | tcl-9c33b6a4755352a1df122cea720c32999a548bdf.zip tcl-9c33b6a4755352a1df122cea720c32999a548bdf.tar.gz tcl-9c33b6a4755352a1df122cea720c32999a548bdf.tar.bz2 |
* generic/tclCmdAH.c New "encoding" Tcl_ObjType (not registered)
* generic/tclEncoding.c that permits longer lifetimes of the
* generic/tclInt.h Tcl_Encoding values kept as intreps of
Tcl_Obj's. Reduces the need for repeated reading of encoding
definition files from the filesystem. [Bug 1077262]
FossilOrigin-Name: 9e0bc07fda2b8bda222792a35529fa77a26f0406
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r-- | generic/tclCmdAH.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/generic/tclCmdAH.c b/generic/tclCmdAH.c index 9c9fe7e..545af15 100644 --- a/generic/tclCmdAH.c +++ b/generic/tclCmdAH.c @@ -11,7 +11,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.12 2005/06/17 23:26:20 dkf Exp $ + * RCS: @(#) $Id: tclCmdAH.c,v 1.27.2.13 2005/07/05 21:18:23 dgp Exp $ */ #include "tclInt.h" @@ -440,24 +440,21 @@ Tcl_EncodingObjCmd(dummy, interp, objc, objv) switch ((enum options) index) { case ENC_CONVERTTO: case ENC_CONVERTFROM: { - char *name; Tcl_Obj *data; if (objc == 3) { - name = NULL; + encoding = Tcl_GetEncoding(interp, NULL); data = objv[2]; } else if (objc == 4) { - name = Tcl_GetString(objv[2]); + if (TclGetEncodingFromObj(interp, objv[2], &encoding) + != TCL_OK) { + return TCL_ERROR; + } data = objv[3]; } else { Tcl_WrongNumArgs(interp, 2, objv, "?encoding? data"); return TCL_ERROR; } - encoding = Tcl_GetEncoding(interp, name); - if (!encoding) { - return TCL_ERROR; - } - if ((enum options) index == ENC_CONVERTFROM) { /* * Treat the string as binary data. |