diff options
author | stanton <stanton> | 1998-09-21 23:39:52 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-09-21 23:39:52 (GMT) |
commit | 494c2de3a748b449c69ce322a1a741f5a31fd4d5 (patch) | |
tree | c3ece48c0ae3f4ba54787e0e8e729b65752ef3f9 /generic/tclStringObj.c | |
parent | 7a698c0488d99c0af42022714638ae1ba2afaa49 (diff) | |
download | tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.zip tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.gz tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.bz2 |
Added contents of Tcl 8.1a2
Diffstat (limited to 'generic/tclStringObj.c')
-rw-r--r-- | generic/tclStringObj.c | 49 |
1 files changed, 39 insertions, 10 deletions
diff --git a/generic/tclStringObj.c b/generic/tclStringObj.c index 6b1f2af..f55fafc 100644 --- a/generic/tclStringObj.c +++ b/generic/tclStringObj.c @@ -14,7 +14,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * SCCS: @(#) tclStringObj.c 1.31 97/10/30 13:56:35 + * SCCS: @(#) tclStringObj.c 1.35 97/11/13 13:40:07 */ #include "tclInt.h" @@ -74,9 +74,9 @@ Tcl_ObjType tclStringType = { Tcl_Obj * Tcl_NewStringObj(bytes, length) - register char *bytes; /* Points to the first of the length bytes + CONST char *bytes; /* Points to the first of the length bytes * used to initialize the new object. */ - register int length; /* The number of bytes to copy from "bytes" + int length; /* The number of bytes to copy from "bytes" * when initializing the new object. If * negative, use bytes up to the first * NULL byte. */ @@ -88,9 +88,9 @@ Tcl_NewStringObj(bytes, length) Tcl_Obj * Tcl_NewStringObj(bytes, length) - register char *bytes; /* Points to the first of the length bytes + CONST char *bytes; /* Points to the first of the length bytes * used to initialize the new object. */ - register int length; /* The number of bytes to copy from "bytes" + int length; /* The number of bytes to copy from "bytes" * when initializing the new object. If * negative, use bytes up to the first * NULL byte. */ @@ -140,9 +140,9 @@ Tcl_NewStringObj(bytes, length) Tcl_Obj * Tcl_DbNewStringObj(bytes, length, file, line) - register char *bytes; /* Points to the first of the length bytes + CONST char *bytes; /* Points to the first of the length bytes * used to initialize the new object. */ - register int length; /* The number of bytes to copy from "bytes" + int length; /* The number of bytes to copy from "bytes" * when initializing the new object. If * negative, use bytes up to the first * NULL byte. */ @@ -165,7 +165,7 @@ Tcl_DbNewStringObj(bytes, length, file, line) Tcl_Obj * Tcl_DbNewStringObj(bytes, length, file, line) - register char *bytes; /* Points to the first of the length bytes + CONST char *bytes; /* Points to the first of the length bytes * used to initialize the new object. */ register int length; /* The number of bytes to copy from "bytes" * when initializing the new object. If @@ -224,7 +224,7 @@ Tcl_SetStringObj(objPtr, bytes, length) Tcl_InvalidateStringRep(objPtr); if (length < 0) { - length = strlen(bytes); + length = (bytes? strlen(bytes) : 0); } TclInitStringRep(objPtr, bytes, length); @@ -335,7 +335,7 @@ Tcl_AppendToObj(objPtr, bytes, length) ConvertToStringType(objPtr); } if (length < 0) { - length = strlen(bytes); + length = (bytes? strlen(bytes) : 0); } if (length == 0) { return; @@ -363,6 +363,35 @@ Tcl_AppendToObj(objPtr, bytes, length) /* *---------------------------------------------------------------------- * + * Tcl_AppendObjToObj -- + * + * This procedure appends the string rep of one object to another. + * + * Results: + * None. + * + * Side effects: + * The string rep of appendObjPtr is appended to the string + * representation of objPtr. + * + *---------------------------------------------------------------------- + */ + +void +Tcl_AppendObjToObj(objPtr, appendObjPtr) + Tcl_Obj *objPtr; /* Points to the object to append to. */ + Tcl_Obj *appendObjPtr; /* Object to append. */ +{ + int length; + char *stringRep; + + stringRep = Tcl_GetStringFromObj(appendObjPtr, &length); + Tcl_AppendToObj(objPtr, stringRep, length); +} + +/* + *---------------------------------------------------------------------- + * * Tcl_AppendStringsToObj -- * * This procedure appends one or more null-terminated strings |