StrIterDataAt
Description
Pointer to the character at absolute index idx in the StrIter’s backing region. Alias-reframe of IterDataAt in string vocabulary; the one-past-end pointer at idx == length is the standard half-open-range upper bound and is well-defined. See IterDataAt for the full contract.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Io.c:2531:
LOG_ERROR("Failed to parse f64: empty input");
DefaultAllocatorDeinit(&scratch);
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:2541:
if ((c == 'i' || c == 'I' || c == 'n' || c == 'N') || (c == '-' && (c1 == 'i' || c1 == 'I'))) {
StrIter saved = si;
Zstr start = StrIterDataAt(&si, StrIterIndex(&si));
while (StrIterPeek(&si, &c) && !IS_SPACE(c)) {
StrIterMustNext(&si);- In
Io.c:2554:
StrDeinit(&temp);
DefaultAllocatorDeinit(&scratch);
return StrIterDataAt(&si, StrIterIndex(&si));
}
StrDeinit(&temp);- In
Io.c:2602:
}
Zstr start = StrIterDataAt(&si, StrIterIndex(&saved));
size pos = StrIterIndex(&si) - StrIterIndex(&saved);- In
Io.c:2644:
LOG_ERROR("Failed to parse u8: empty input");
DefaultAllocatorDeinit(&scratch);
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:2648:
if (fmt_info && (fmt_info->flags & FMT_FLAG_CHAR)) {
Zstr next = read_chars_internal(StrIterDataAt(&si, StrIterIndex(&si)), (u8 *)v, sizeof(*v), fmt_info);
DefaultAllocatorDeinit(&scratch);
return next;- In
Io.c:2663:
}
Zstr start = StrIterDataAt(&si, StrIterIndex(&saved));
size pos = StrIterIndex(&si) - StrIterIndex(&saved);- In
Io.c:2763:
LOG_ERROR("Failed to parse " #NAME ": empty input"); \
DefaultAllocatorDeinit(&scratch); \
return StrIterDataAt(&si, StrIterIndex(&si)); \
} \
\
- In
Io.c:2774:
} \
\
Zstr start = StrIterDataAt(&si, StrIterIndex(&saved)); \
size pos = StrIterIndex(&si) - StrIterIndex(&saved); \
Str temp = StrInitFromCstr(start, pos, &scratch); \
- In
Io.c:3060:
if (!StrIterRemainingLength(&si)) {
LOG_ERROR("Empty input string");
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:3063:
}
Zstr start = StrIterDataAt(&si, StrIterIndex(&si));
char c0 = 0;- In
Io.c:3087:
Str hex_str = StrInitFromCstr(
StrIterDataAt(&si, StrIterIndex(&hex_saved)),
StrIterIndex(&si) - StrIterIndex(&hex_saved),
BitVecAllocator(bv)- In
Io.c:3108:
*bv = BitVecFromInteger(value, bit_len, BitVecAllocator(bv));
StrDeinit(&hex_str);
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:3128:
Str oct_str = StrInitFromCstr(
StrIterDataAt(&si, StrIterIndex(&oct_saved)),
StrIterIndex(&si) - StrIterIndex(&oct_saved),
BitVecAllocator(bv)- In
Io.c:3146:
*bv = BitVecFromInteger(value, bit_len, BitVecAllocator(bv));
StrDeinit(&oct_str);
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:3162:
Str bin_str = StrInitFromCstr(
StrIterDataAt(&si, StrIterIndex(&bin_saved)),
StrIterIndex(&si) - StrIterIndex(&bin_saved),
BitVecAllocator(bv)- In
Io.c:3170:
StrDeinit(&bin_str);
return StrIterDataAt(&si, StrIterIndex(&si));
}
#endif // FEATURE_BITVEC
- In
Io.c:3196:
if (!StrIterRemainingLength(&si)) {
LOG_ERROR("Failed to parse Int: empty input");
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:3201:
StrIter saved = si;
StrIter digits_saved = si;
Zstr start = StrIterDataAt(&si, StrIterIndex(&saved));
u8 radix = int_fmt_radix_from_flags(fmt_info);- In
Io.c:3257:
StrDeinit(&temp);
return StrIterDataAt(&si, StrIterIndex(&si));
}
#endif // FEATURE_INT
- In
Io.c:3295:
StrDeinit(&temp);
FloatDeinit(&parsed);
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:3298:
}
start = StrIterDataAt(&si, StrIterIndex(&si));
token_len = float_fmt_token_length(start);- In
Io.c:3350:
LOG_ERROR("Failed to parse f32: empty input");
DefaultAllocatorDeinit(&scratch);
return StrIterDataAt(&si, StrIterIndex(&si));
}- In
Io.c:3360:
if ((c == 'i' || c == 'I' || c == 'n' || c == 'N') || (c == '-' && (c1 == 'i' || c1 == 'I'))) {
StrIter saved = si;
Zstr start = StrIterDataAt(&si, StrIterIndex(&si));
while (StrIterPeek(&si, &c) && !IS_SPACE(c)) {
StrIterMustNext(&si);- In
Io.c:3375:
StrDeinit(&temp);
DefaultAllocatorDeinit(&scratch);
return StrIterDataAt(&si, StrIterIndex(&si));
}
StrDeinit(&temp);- In
Io.c:3420:
}
Zstr start = StrIterDataAt(&si, StrIterIndex(&saved));
size pos = StrIterIndex(&si) - StrIterIndex(&saved);- In
ProcMaps.c:152:
out->perms = perms;
out->file_offset = offset;
out->path = (Zstr)StrIterDataAt(si, path_start_pos); // may be empty if anonymous
if (line_terminator_pos < StrIterLength(si) && *StrIterDataAt(si, line_terminator_pos) == '\n') {- In
ProcMaps.c:154:
out->path = (Zstr)StrIterDataAt(si, path_start_pos); // may be empty if anonymous
if (line_terminator_pos < StrIterLength(si) && *StrIterDataAt(si, line_terminator_pos) == '\n') {
// intentional bypass: in-place mutation of the iter's backing
// buffer to NUL-terminate the path slice we just exposed via
- In
ProcMaps.c:159:
// `out->path`. Iter accessors are read-only; no public mutator
// covers single-byte writes to the underlying storage.
*StrIterDataAt(si, line_terminator_pos) = '\0';
StrIterMustNext(si);
}- In
Dns.c:310:
// the longest reasonable IPv6-with-zone-id literal.
StrInitStack(ip_buf, 64) {
StrPushBackMany(&ip_buf, (Zstr)StrIterDataAt(&si, ip_start), ip_len);
got_v4 = parse_ipv4(StrBegin(&ip_buf), v4);
if (!got_v4) {- In
Dns.c:339:
HostsEntry e = {0};
e.name = StrInitFromCstr((Zstr)StrIterDataAt(&si, nm_start), nm_len, alloc);
ascii_lower((u8 *)StrBegin(&e.name), StrLen(&e.name));
if (got_v4) {- In
Dns.c:396:
char sep;
if (StrIterRemainingLength(&si) > kw_len &&
MemCompare(StrIterDataAt(&si, StrIterIndex(&si)), NS_KEYWORD, kw_len) == 0 &&
StrIterPeekAt(&si, (i64)kw_len, &sep) && (sep == ' ' || sep == '\t')) {
StrIterMustMove(&si, (i64)kw_len);- In
Dns.c:408:
if (ip_len > 0 && ip_len < 64) {
StrInitStack(ip_buf, 64) {
StrPushBackMany(&ip_buf, (Zstr)StrIterDataAt(&si, ip_start), ip_len);
u8 v4[4] = {0};
u8 v6[16] = {0};- In
JSON.c:275:
LOG_ERROR(
"No unicode support '{.6}'. Unicode sequence will be skipped.",
LVAL(StrIterDataAt(&si, StrIterIndex(&si) - 1))
);
StrIterMustMove(&si, 5);- In
JSON.c:403:
if (!StrLen(&ns)) {
LOG_ERROR("Failed to parse number. '{.8}'", LVAL(StrIterDataAt(&saved_si, StrIterIndex(&saved_si))));
StrDeinit(&ns);
DefaultAllocatorDeinit(&scratch);- In
Dns.c:54:
return false;
}
if (!BufPushBytes(out, (const u8 *)StrIterDataAt(&si, seg_start), seg_len)) {
return false;
}
Last updated on