Skip to content
StrIterMustMove

StrIterMustMove

Description

Aborting variant of StrIterMove. Alias for IterMustMove; see IterMustMove for the full contract.

Parameters

Name Direction Description
si in Pointer to the StrIter cursor to move.
n in Signed character offset; negative steps backward.

Success

Cursor position is updated; returns to the caller.

Failure

Does not return – aborts via LOG_FATAL when the target position would be out of range.

Usage example (Cross-references)

Usage examples (Cross-references)
            // zero-initialised; the only way it carries 'x'/'X' here is that
            // the offset-1 peek succeeded, which proves 2 bytes are available.
            StrIterMustMove(&si, 2);
            StrIter hex_saved = si;
            // can only happen when the offset-1 peek succeeded, proving 2 bytes
            // remain ahead of the cursor.
            StrIterMustMove(&si, 2);
            StrIter oct_saved = si;
                MemCompare(StrIterDataAt(&si, StrIterIndex(&si)), NS_KEYWORD, kw_len) == 0 &&
                StrIterPeekAt(&si, (i64)kw_len, &sep) && (sep == ' ' || sep == '\t')) {
                StrIterMustMove(&si, (i64)kw_len);
                skip_hspace_iter(&si);
        if (p3 == 'p')
            perms |= PROC_MAP_PERM_PRIVATE;
        StrIterMustMove(si, 4);
        skip_ws(si);
                Zstr pos = StrIterPos(&si);
                if (pos && ZstrCompareN(pos, "true", 4) == 0) {
                    StrIterMustMove(&si, 4);
                    *b = true;
                    return si;
                    Zstr pos = StrIterPos(&si);
                    if (pos && ZstrCompareN(pos, "false", 5) == 0) {
                        StrIterMustMove(&si, 5);
                        *b = false;
                        return si;
                Zstr pos = StrIterPos(&si);
                if (pos && ZstrCompareN(pos, "null", 4) == 0) {
                    StrIterMustMove(&si, 4);
                    *is_null = true;
                    return si;
Last updated on