diff options
author | dkf <dkf@noemail.net> | 2007-04-10 14:47:06 (GMT) |
---|---|---|
committer | dkf <dkf@noemail.net> | 2007-04-10 14:47:06 (GMT) |
commit | 807909c8786778cefc690ac7f1eb5e7fce6757c9 (patch) | |
tree | e12acd4bb445070087067812722f564f29218f8d /generic/tclLink.c | |
parent | a4830b01f6f650ea70a34c388fcee6966cdb3222 (diff) | |
download | tcl-807909c8786778cefc690ac7f1eb5e7fce6757c9.zip tcl-807909c8786778cefc690ac7f1eb5e7fce6757c9.tar.gz tcl-807909c8786778cefc690ac7f1eb5e7fce6757c9.tar.bz2 |
Handle creation of Tcl_Objs from constant strings better (easier to use, more
efficient). After [Patch 1529526] (afredd)
FossilOrigin-Name: 4d69119aadb4298f8e994440eb988c6c46396086
Diffstat (limited to 'generic/tclLink.c')
-rw-r--r-- | generic/tclLink.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/generic/tclLink.c b/generic/tclLink.c index bdfa4db..8d3bc1a 100644 --- a/generic/tclLink.c +++ b/generic/tclLink.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclLink.c,v 1.20 2007/03/20 21:20:12 dgp Exp $ + * RCS: @(#) $Id: tclLink.c,v 1.21 2007/04/10 14:47:16 dkf Exp $ */ #include "tclInt.h" @@ -552,6 +552,7 @@ ObjValue( Link *linkPtr) /* Structure describing linked variable. */ { char *p; + Tcl_Obj *resultObj; switch (linkPtr->type) { case TCL_LINK_INT: @@ -599,7 +600,8 @@ ObjValue( case TCL_LINK_STRING: p = LinkedVar(char *); if (p == NULL) { - return Tcl_NewStringObj("NULL", 4); + TclNewLiteralStringObj(resultObj, "NULL"); + return resultObj; } return Tcl_NewStringObj(p, -1); @@ -609,7 +611,8 @@ ObjValue( */ default: - return Tcl_NewStringObj("??", 2); + TclNewLiteralStringObj(resultObj, "??"); + return resultObj; } } |