summaryrefslogtreecommitdiffstats
path: root/generic/tclCmdAH.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2005-07-05 21:18:14 (GMT)
committerdgp <dgp@users.sourceforge.net>2005-07-05 21:18:14 (GMT)
commitb70197afbdb6e71461ae861830db8f544fc47505 (patch)
treeb66ee0bc1d9995dfd54be7ef3fa6d9d8a30024ac /generic/tclCmdAH.c
parentbf7695058ddedaee83cf8f2386277dded31a5260 (diff)
downloadtcl-b70197afbdb6e71461ae861830db8f544fc47505.zip
tcl-b70197afbdb6e71461ae861830db8f544fc47505.tar.gz
tcl-b70197afbdb6e71461ae861830db8f544fc47505.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]
Diffstat (limited to 'generic/tclCmdAH.c')
-rw-r--r--generic/tclCmdAH.c15
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.