summaryrefslogtreecommitdiffstats
path: root/doc/StringObj.3
diff options
context:
space:
mode:
authorericm <ericm>2000-09-14 18:42:27 (GMT)
committerericm <ericm>2000-09-14 18:42:27 (GMT)
commit9e68d5fcbb5c7e9d1e17dcaacab6688f786bcd10 (patch)
treede9d337513da3daa50909f5c0d11116e6ab9262e /doc/StringObj.3
parent62db39876a0a1797a02f9ab37238f2d377295696 (diff)
downloadtcl-9e68d5fcbb5c7e9d1e17dcaacab6688f786bcd10.zip
tcl-9e68d5fcbb5c7e9d1e17dcaacab6688f786bcd10.tar.gz
tcl-9e68d5fcbb5c7e9d1e17dcaacab6688f786bcd10.tar.bz2
* doc/Alloc.3: Added entries for Tcl_AttemptAlloc, Tcl_AttempRealloc.
* doc/StringObj.3: Added entry for Tcl_AttemptSetObjLength. * generic/tclDecls.h: * generic/tclStubInit.c: Regen'ed stubs files from new tcl.decls. * generic/tcl.decls: Added stubs for the Tcl_Attempt* memory allocators and for Tcl_AttemptSetObjLength. * generic/tcl.h: Added #define's for attemptckalloc, attemptckrealloc, which map to the Tcl_Attempt* memory allocators. * generic/tclCkalloc.c: Added non-panic'ing versions of Tcl_Alloc, Tcl_Realloc, etc.; these are called Tcl_AttemptAlloc, Tcl_AttemptRealloc, etc. These are used by Tcl_AttemptSetObjLength and the string obj append functions. * generic/tclStringObj.c: Modified string growth algorithm to use doubling algorithm as long as possible, and only fall back when that fails. Added Tcl_AttemptSetObjLength, and modified AppendUnicodeToUnicodeRep, AppendUtfToUtfRep, and Tcl_AppendStringsToObjVA to support this.
Diffstat (limited to 'doc/StringObj.3')
-rw-r--r--doc/StringObj.315
1 files changed, 14 insertions, 1 deletions
diff --git a/doc/StringObj.3 b/doc/StringObj.3
index d195362..23273d0 100644
--- a/doc/StringObj.3
+++ b/doc/StringObj.3
@@ -4,7 +4,7 @@
'\" See the file "license.terms" for information on usage and redistribution
'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
'\"
-'\" RCS: @(#) $Id: StringObj.3,v 1.5 1999/06/15 01:16:21 hershey Exp $
+'\" RCS: @(#) $Id: StringObj.3,v 1.6 2000/09/14 18:42:29 ericm Exp $
'\"
.so man.macros
.TH Tcl_StringObj 3 8.1 Tcl "Tcl Library Procedures"
@@ -71,6 +71,9 @@ void
void
\fBTcl_SetObjLength\fR(\fIobjPtr, newLength\fR)
.sp
+int
+\fBTcl_AttemptSetObjLength\fR(\fIobjPtr, newLength\fR)
+.sp
Tcl_Obj *
\fBTcl_ConcatObj\fR(\fIobjc, objv\fR)
.SH ARGUMENTS
@@ -227,6 +230,16 @@ enlarged in a subsequent call to \fBTcl_SetObjLength\fR without
reallocating storage. In all cases \fBTcl_SetObjLength\fR leaves
a null character at \fIobjPtr->bytes[newLength]\fR.
.PP
+\fBTcl_AttemptSetObjLength\fR is identical in function to
+\fBTcl_SetObjLength\fR except that if sufficient memory to satisfy the
+request cannot be allocated, it does not cause the Tcl interpreter to
+\fBpanic\fR. Thus, if \fInewLength\fR is greater than the space
+allocated for the object's string, and there is not enough memory
+available to satisfy the request, \fBTcl_AttemptSetObjLength\fR will take
+no action and return 0 to indicate failure. If there is enough memory
+to satisfy the request, \fBTcl_AttemptSetObjLength\fR behaves just like
+\fBTcl_SetObjLength\fR and returns 1 to indicate success.
+.PP
The \fBTcl_ConcatObj\fR function returns a new string object whose
value is the space-separated concatenation of the string
representations of all of the objects in the \fIobjv\fR