tobogganSe connecter

louise

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Runtime: escape and URL-decode without intermediate strings

tl_html_escape looped char by char into a fresh Rust String, which was
then copied into a Louise string: two allocations and two passes per
text node and attribute, even when nothing needs escaping (the common
case). tl_url_decode spent about three allocations per segment the same
way (Vec, the lossy String, the Louise string).

Both externs are now `owned` (transparent to callers: Perceus manages
the references, and the interpreter does not care). A clean input — no
& < > " ', or no % and no + — is returned as is: no allocation, no
reference-count traffic; immortal, shared and local blocks all pass
through (rc 0 / negative / positive are all correct without a touch).
A dirty input is written straight into one fresh string block, pre-sized
from the same scan (html_escaped_len; for a decode s.len(), which is
never exceeded), so the Rust-String middleman is gone. A decode that
shrinks resizes the block (string_shrink): the System-allocator free
path derives a block's layout from its length word, so it must not stay
over-long. Decoded bytes that are not valid UTF-8 still take the lossy
path, into a second string (rare) — semantics byte-identical, invalid
escapes and all.

The kernels stay in louise_rt_prims, shared with the interpreter, as a
span iterator (html_escaped) and an into-buffer decode
(url_decode_into), so there is still one semantics. Differential tests
cover the five metacharacters, combinations, empty and multibyte
inputs, pre-escaped &amp;, lone %, %zz, %00, + at the edges and UTF-8
spanning escapes; the runtime tests assert a clean input is the same
block back, under the leak oracle, and tests/run/escape_decode.lse pins
both backends on the owned call with the input kept alive past it.

olivier · il y a 1 mois · acaa6ae4d2fe06bc5633e23ee0cb7db40fa35432

Parents 0454a77

8 fichiers modifiés, 362 ajouts, 33 suppressions