An arena is an object that does allocation on user's behalf and can deallocate all at once.
More...
|
| void | sol_arena_del (struct sol_arena *arena) |
| | Delete the Arena. More...
|
| |
| struct sol_arena * | sol_arena_new (void) |
| | Creates an Arena. More...
|
| |
| int | sol_arena_slice_dup (struct sol_arena *arena, struct sol_str_slice *dst, struct sol_str_slice src) |
| | Store a copy of a given string slice in the arena. More...
|
| |
| int | sol_arena_slice_dup_str (struct sol_arena *arena, struct sol_str_slice *dst, const char *src) |
| | Store a copy of a given string in the arena. More...
|
| |
| int | sol_arena_slice_dup_str_n (struct sol_arena *arena, struct sol_str_slice *dst, const char *src, size_t n) |
| | Store a copy of at most n characters of a given string in the arena. More...
|
| |
| int | sol_arena_slice_sprintf (struct sol_arena *arena, struct sol_str_slice *dst, const char *fmt,...) SOL_ATTR_PRINTF(3 |
| | Store the output of 'sprintf()' in the arena. More...
|
| |
| char * | sol_arena_str_dup_n (struct sol_arena *arena, const char *str, size_t n) |
| | Store a copy of at most n characters of a given string in the arena. More...
|
| |
| int char * | sol_arena_strdup (struct sol_arena *arena, const char *str) |
| | Store a copy of a given string in the arena. More...
|
| |
| char * | sol_arena_strdup_slice (struct sol_arena *arena, const struct sol_str_slice slice) |
| | Store a copy of a given string slice in the arena. More...
|
| |
An arena is an object that does allocation on user's behalf and can deallocate all at once.
- See Also
- String slice
Sol Arena type.
See also sol_buffer if you just need a single re-sizable buffer.
| void sol_arena_del |
( |
struct sol_arena * |
arena | ) |
|
Delete the Arena.
Delete the arena and all it's contents. Frees all the memory previously allocated by the arena.
- Parameters
-
Creates an Arena.
- Returns
- The new arena,
NULL in case of error
Store a copy of a given string slice in the arena.
Also, outputs the recently stored string src in dst.
- Parameters
-
| arena | The arena |
| dst | String slice of the recently added string slice |
| src | String slice to copy and store |
- Returns
0 on success, error code (always negative) otherwise
Store a copy of a given string in the arena.
Also, outputs a slice to the stored string in dst.
- Parameters
-
| arena | The arena |
| dst | String slice of the recently added string |
| src | String to copy and store |
- Returns
0 on success, error code (always negative) otherwise
| int sol_arena_slice_dup_str_n |
( |
struct sol_arena * |
arena, |
|
|
struct sol_str_slice * |
dst, |
|
|
const char * |
src, |
|
|
size_t |
n |
|
) |
| |
Store a copy of at most n characters of a given string in the arena.
Also, outputs a slice to the stored string in dst.
- Parameters
-
| arena | The arena |
| dst | String slice of the recently added string |
| src | String to copy and store |
| n | Maximum number of characters to copy |
- Returns
0 on success, error code (always negative) otherwise
Store the output of 'sprintf()' in the arena.
Also, outputs a slice to the stored string in dst.
- Parameters
-
| arena | The arena |
| dst | String slice of the recently added string |
| fmt | A standard 'printf()' format string |
| ... | The arguments for 'sprintf()' |
- Returns
0 on success, error code (always negative) otherwise
| char* sol_arena_str_dup_n |
( |
struct sol_arena * |
arena, |
|
|
const char * |
str, |
|
|
size_t |
n |
|
) |
| |
Store a copy of at most n characters of a given string in the arena.
- Parameters
-
| arena | The arena |
| str | String to copy and store |
| n | Maximum number of characters to copy |
- Returns
- The stored string
| int char* sol_arena_strdup |
( |
struct sol_arena * |
arena, |
|
|
const char * |
str |
|
) |
| |
Store a copy of a given string in the arena.
- Parameters
-
| arena | The arena |
| str | String to copy and store |
- Returns
- The stored string
Store a copy of a given string slice in the arena.
- Parameters
-
| arena | The arena |
| slice | String slice to copy and store |
- Returns
- The stored string