ZstrIOArg
Description
Explicit raw C-string I/O descriptor with allocator provenance.
This is used when a formatted I/O call needs to read into or rewrite a caller-owned zero-terminated string pointer whose storage may already be managed by a specific allocator.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in,out | Address of the char * / Zstr variable. |
allocator |
in | Allocator responsible for any existing pointed-to storage. |
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.h:151:
void *value;
Allocator *allocator;
} ZstrIOArg;
#ifdef __cplusplus- In
Io.h:204:
#ifdef __cplusplus
# define ZstrIO(zstr, alloc_ptr) \
TO_TYPE_SPECIFIC_IO(ZstrAlloc, &LVAL(((ZstrIOArg) {.value = (void *)&(zstr), .allocator = (alloc_ptr)})))
#else
# define ZstrIO(zstr, alloc_ptr) \- In
Io.h:210:
.writer = (TypeSpecificWriter)_write_ZstrAlloc, \
.reader = (TypeSpecificReader)_read_ZstrAlloc, \
.data = &((ZstrIOArg) {.value = (void *)&(zstr), .allocator = (alloc_ptr)}), \
})
#endif- In
Io.h:748:
bool _write_i64(Str *o, FmtInfo *fmt_info, i64 *v);
bool _write_Zstr(Str *o, FmtInfo *fmt_info, Zstr *s);
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg);
bool _write_f32(Str *o, FmtInfo *fmt_info, f32 *v);
bool _write_f64(Str *o, FmtInfo *fmt_info, f64 *v);- In
Io.h:773:
Zstr _read_i64(Zstr i, FmtInfo *fmt_info, i64 *v);
Zstr _read_Zstr(Zstr i, FmtInfo *fmt_info, Zstr *v);
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg);
Zstr _read_f32(Zstr i, FmtInfo *fmt_info, f32 *v);
Zstr _read_f64(Zstr i, FmtInfo *fmt_info, f64 *v);- In
Io.c:1929:
}
bool _write_ZstrAlloc(Str *o, FmtInfo *fmt_info, ZstrIOArg *arg) {
Zstr *value = NULL;- In
Io.c:2981:
}
Zstr _read_ZstrAlloc(Zstr i, FmtInfo *fmt_info, ZstrIOArg *arg) {
char **out = NULL;
char *previous = NULL;- In
Io.Read.c:1485:
char *out = NULL;
ZstrIOArg arg = {.value = (void *)&out, .allocator = alloc_base};
FmtInfo fmt = {0}; // max_read_len == 0 -> hits the !max_read_len branch
- In
Io.Read.c:1509:
char *out = NULL;
ZstrIOArg arg = {.value = (void *)&out, .allocator = alloc_base};
Zstr next = _read_ZstrAlloc(input, NULL, &arg);
Last updated on