Files
ww/cmd/w6l/sym.c
Hojun-Cho 62b9d20383 toolchain: banner purge + WHY-only comment sweep (rule 8)
selfhost/, cmd/, internal/ join the tree-wide sweep: every section
banner dies (91 selfhost + the cmd C-style dividers -> 0); narration
and stale contracts deleted (pre-#22 bundler notes, retired
single-PT_LOAD and no-archive claims, superseded ABI tables); every
ref/harec/qbe cite, task cite, encoding/ELF contract, and rule-10
twin pointer kept; lost lifetime/rationale lines restored where the
sweep over-cut (elf_globals ownership, kwtab linear-scan). Comment-
only proven: all five wwstage tool binaries byte-identical across
the sweep; test-commit, test-byteid (161+1399, 0 pinned-divergent),
and test-bootstrap (fixed point + 991-995 byte-id) all exit 0.
The read-through banked 66 latent-bug leads (checkpoint).
2026-08-08 23:14:03 +09:00

28 lines
534 B
C

/*
* Plain singly-linked list; usually a few hundred entries, hashing
* isn't worth it yet.
*/
#include "l.h"
#include <stdlib.h>
#include <string.h>
Lsym *
l_intern(Lnk *l, const char *name)
{
for (Lsym *s = l->syms; s; s = s->next)
if (strcmp(s->name, name) == 0) return s;
Lsym *s = calloc(1, sizeof *s);
s->name = strdup(name);
s->next = l->syms;
l->syms = s;
return s;
}
Lsym *
l_lookup(Lnk *l, const char *name)
{
for (Lsym *s = l->syms; s; s = s->next)
if (strcmp(s->name, name) == 0) return s;
return NULL;
}