INNER CODE UNIT · Python
scrub_defines
wolfSSL/wolfBoot · tools/sbom/sbom-driver.py:62
def scrub_defines(text):
"""Redact absolute-path tokens from a flat #define header text.
A macro value that is (or contains) an absolute path would otherwise make
the SBOM machine-specific and leak the local file system. The macro name is
kept, so the configuration record stays complete.
"""
out = []
for line in text.splitlines():
m = _DEFINE.match(line)
if not m:
out.append(line)
continue
name, val = m.group(1), m.group(2)
if val == "":
out.append(line)
continue
toks = []