string_init_type
Name
string_init_type — Initialize a string and pre-allocate its storage, specifying its backing type
Synopsis
#include "misc/ec_string.h"
| int **string_init_type** (
| str, | |
| | size, | |
| | type)
; | |
string * <var class="pdparam">str</var>
;
size_t <var class="pdparam">size</var>
;
int <var class="pdparam">type</var>
;
Description
Initialize a string and pre-allocate its storage, specifying its backing type.
Note
Objects created using string_init_type
should be destroyed using string_destroy.
- str
-
The string.
- size
-
The size of the initial buffer to allocate (including the terminating NULL); must not be
0
. - type
-
The string type (one of STRING_TYPE_*). For a listing of the string types see “string”.
Starting with Momentum 3.0, the type parameter may be any valid sized memtype ID, either one from the core product (MEMTYPE_XXX defines) or registered by a module.
Returns 1
if the buffer was successfully allocated, otherwise 0
.
It is legal to call this function in any thread.