refactor(gen): R12/R13 同步——下标 while 循环改 for range、去 c.Set

与 includes 同步执行两批源改写:R12 把「i: int = 0 与 while i < N: … i += 1」形式的计数循环改写为「for i in range(N):」;R13 把 c.Set(*p, v) 迁移为 *p = v、c.Set(a, b) 迁移为 a = b(c.Set 是正在退化的路径)。

验证:bootstrap 三重重编 SUCCESS(无 vast_c 解析回退);全量 77/77 顺序回归通过(WebTest 首轮网络超时,单独重跑通过)。
This commit is contained in:
TermiNexus committed 2026-10-05 15:33:58 +08:00
1 parent a7b8118ce8
commit fb53f88893
25 files changed
+133 -345

No files matched your search

+2 -6
View File
@@ -267,8 +267,7 @@ def _normalize_path(path: str) -> str:
seg_start: sizet = 0
out_len: sizet = 0
has_seg: int = 0
i: sizet = 0
while i <= plen:
for i in range(plen + 1):
ch: char = '\0'
if i < plen: ch = path[i]
if ch == '/' or ch == '\\' or ch == '\0':
@@ -313,7 +312,6 @@ def _normalize_path(path: str) -> str:
jj += 1
has_seg = 1
seg_start = i + 1
i += 1
if has_seg == 0:
# All segments consumed (e.g. ./..): return current dir
return "./"
@@ -577,8 +575,7 @@ def slice_subdir(sha1: str, level: int) -> str:
buf: str = _mbuddy.alloc(buf_len)
if buf is None: return None
pos: int = 0
i: int = 0
while i < level:
for i in range(level):
if i > 0:
buf[pos] = '/'
pos += 1
@@ -586,6 +583,5 @@ def slice_subdir(sha1: str, level: int) -> str:
buf[pos] = sha1[idx]
buf[pos + 1] = sha1[idx + 1]
pos += 2
i += 1
buf[pos] = '\0'
return buf