summaryrefslogtreecommitdiffstats
path: root/generic/tclMain.c
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2012-08-04 07:52:39 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2012-08-04 07:52:39 (GMT)
commit4aff1e5a4ca6dc45fa445b23777e3d8dd728c82c (patch)
treef191ab6d4e59ba4240dd4544b19de87c4da601dd /generic/tclMain.c
parent945186c2fac7c4c3ba9275d1c6cbb45b8e10a954 (diff)
parent24ef33dc101a3e9114318b884c1e99d792f4739d (diff)
downloadtcl-dkf_utf16_branch.zip
tcl-dkf_utf16_branch.tar.gz
tcl-dkf_utf16_branch.tar.bz2
merge trunkdkf_utf16_branch
Diffstat (limited to 'generic/tclMain.c')
-rw-r--r--generic/tclMain.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/generic/tclMain.c b/generic/tclMain.c
index 373e3f6..88b4e51 100644
--- a/generic/tclMain.c
+++ b/generic/tclMain.c
@@ -53,20 +53,23 @@
#endif
/*
- * Further on, in UNICODE mode, we need to use Tcl_NewUnicodeObj,
- * while otherwise NewNativeObj is needed (which provides proper
- * conversion from native encoding to UTF-8).
+ * Further on, in UNICODE mode we just use Tcl_NewUnicodeObj, otherwise
+ * NewNativeObj is needed (which provides proper conversion from native
+ * encoding to UTF-8).
*/
+
#ifdef UNICODE
# define NewNativeObj Tcl_NewUnicodeObj
#else /* !UNICODE */
- static Tcl_Obj *NewNativeObj(char *string, int length) {
- Tcl_Obj *obj;
- Tcl_DString ds;
- Tcl_ExternalToUtfDString(NULL, string, length, &ds);
- obj = Tcl_NewStringObj(Tcl_DStringValue(&ds), Tcl_DStringLength(&ds));
- Tcl_DStringFree(&ds);
- return obj;
+static inline Tcl_Obj *
+NewNativeObj(
+ char *string,
+ int length)
+{
+ Tcl_DString ds;
+
+ Tcl_ExternalToUtfDString(NULL, string, length, &ds);
+ return TclDStringToObj(&ds);
}
#endif /* !UNICODE */