diff options
author | dgp <dgp@users.sourceforge.net> | 2009-02-10 14:38:55 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2009-02-10 14:38:55 (GMT) |
commit | 34980e46f1c6693dba7bcab875f6a227085a87ec (patch) | |
tree | 1c84d2ef87c6206ed3b3e2e877e2b5f814cc9f9e /generic | |
parent | 70737b4c24853238f8a5ec5ef6a878022e94c978 (diff) | |
download | tcl-34980e46f1c6693dba7bcab875f6a227085a87ec.zip tcl-34980e46f1c6693dba7bcab875f6a227085a87ec.tar.gz tcl-34980e46f1c6693dba7bcab875f6a227085a87ec.tar.bz2 |
* generic/tclStringObj.c (Tcl_GetUnicode*): Reduce code duplication.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclStringObj.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 589d046..da17c2f 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -33,7 +33,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclStringObj.c,v 1.87 2009/02/05 21:27:45 dkf Exp $ */ + * RCS: @(#) $Id: tclStringObj.c,v 1.88 2009/02/10 14:38:55 dgp Exp $ */ #include "tclInt.h" #include "tommath.h" @@ -544,30 +544,7 @@ Tcl_GetUnicode( Tcl_Obj *objPtr) /* The object to find the unicode string * for. */ { - String *stringPtr; - - SetStringFromAny(NULL, objPtr); - stringPtr = GET_STRING(objPtr); - - if ((stringPtr->numChars == -1) || (stringPtr->hasUnicode == 0)) { - /* - * We haven't yet calculated the length, or all of the characters in - * the Utf string are 1 byte chars (so we didn't store the unicode - * str). Since this function must return a unicode string, and one has - * not yet been stored, force the Unicode to be calculated and stored - * now. - */ - - FillUnicodeRep(objPtr); - - /* - * We need to fetch the pointer again because we have just reallocated - * the structure to make room for the Unicode data. - */ - - stringPtr = GET_STRING(objPtr); - } - return stringPtr->unicode; + return Tcl_GetUnicodeFromObj(objPtr, NULL); } /* |