2001-02-02 17:54:47 +00:00
|
|
|
.TH stralloc_ready 3
|
|
|
|
.SH NAME
|
|
|
|
stralloc_ready \- provide space in a stralloc
|
|
|
|
.SH SYNTAX
|
2002-04-13 13:53:24 +00:00
|
|
|
.B #include <stralloc.h>
|
2001-02-02 17:54:47 +00:00
|
|
|
|
2006-11-07 17:56:05 +00:00
|
|
|
int \fBstralloc_ready\fP(stralloc* \fIsa\fR,size_t \fIlen\fR);
|
2001-02-02 17:54:47 +00:00
|
|
|
.SH DESCRIPTION
|
|
|
|
stralloc_ready makes sure that \fIsa\fR has enough space allocated to hold
|
|
|
|
\fIlen\fR bytes: If \fIsa\fR is not allocated, stralloc_ready allocates at least
|
|
|
|
\fIlen\fR bytes of space, and returns 1. If \fIsa\fR is already allocated, but
|
|
|
|
not enough to hold \fIlen\fR bytes, stralloc_ready allocates at least \fIlen\fR
|
|
|
|
bytes of space, copies the old string into the new space, frees the
|
|
|
|
old space, and returns 1. Note that this changes \fIsa\fR.s.
|
2002-10-17 18:43:19 +00:00
|
|
|
|
|
|
|
If stralloc_ready runs out of memory, it leaves \fIsa\fR alone and
|
|
|
|
returns 0.
|
2004-11-25 21:29:35 +00:00
|
|
|
.SH "RETURN VALUE"
|
|
|
|
1 for success, 0 on memory allocation failure.
|
2001-02-02 17:54:47 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
stralloc_readyplus(3)
|