query_parse.sg is the T16 sprint — the inverse of T15 form_encode. Reads a percent-encoded query string from qs_buf @0x4D0000. Splits on & for segments, = for key/value pairs. decode_seg() handles %XX percent-decoding via hex_val() nibble lookup. Decoded bytes written to dec_buf @0x4F0000; 4 key/value pairs (as {key_off, key_len, val_off, val_len} structs) stored at qp_buf @0x4E0000. QUERY-PARSE-PASS 8/8. 11168 B arm-el0.
Query string decoder
query_parse()
Percent-decode + & / = split, 4-pair store —
query_parse(qs_buf, dec_buf, qp_buf, max_pairs): parses the query string in qs_buf into at most max_pairs (=4) key/value pairs. Algorithm: (1) scan qs_buf for & delimiters to split into segments; (2) for each segment, scan for = to split key from value; (3) for each key and value, call decode_seg(src, dst) which copies bytes to dst, expanding %XX sequences via hex_val(c) (returns 0–15 for '0'–'9' and 'A'–'F'); (4) write a {key_off, key_len, val_off, val_len} record to qp_buf. Test input: "username=alice&message=hello%20world&score=42&tag=foo%26bar". Expected pairs: username=alice, message=hello world, score=42, tag=foo&bar. QUERY-PARSE-PASS 8/8 (4 key decode, 4 value decode checks, %20→space, %26→&).