diff options
| author | donal.k.fellows@manchester.ac.uk <dkf> | 2012-04-25 12:07:45 (GMT) |
|---|---|---|
| committer | donal.k.fellows@manchester.ac.uk <dkf> | 2012-04-25 12:07:45 (GMT) |
| commit | 2d0545c937ed0e491f8e155dde41c9a62bd7dc86 (patch) | |
| tree | 9287ec35f60eeed086288278741ae7b69817beda /generic/tclMain.c | |
| parent | eaa02eccbd4b1111d5775d38bd135ef3425da6bb (diff) | |
| download | tcl-2d0545c937ed0e491f8e155dde41c9a62bd7dc86.zip tcl-2d0545c937ed0e491f8e155dde41c9a62bd7dc86.tar.gz tcl-2d0545c937ed0e491f8e155dde41c9a62bd7dc86.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.
Diffstat (limited to 'generic/tclMain.c')
| -rw-r--r-- | generic/tclMain.c | 23 |
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 */ |
