From 5e57bafdaf9d26d9445cc89055563e81e13670d3 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 23 Nov 2025 01:29:01 -0500 Subject: Bugfix with ID having a trailing newline --- src/naming.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/naming.c b/src/naming.c index 484e1998..9c0f09e4 100644 --- a/src/naming.c +++ b/src/naming.c @@ -94,11 +94,16 @@ Text_t valid_c_name(const char *name) { return Text$from_str(name); } +#include "stdlib/stdlib.h" public Text_t CONSTFUNC namespace_name(env_t *env, namespace_t *ns, Text_t name) { - for (; ns; ns = ns->parent) + if (Text$has(name, Text("\n"))) fail("WTF??"); + for (; ns; ns = ns->parent) { + if (strchr(ns->name, '\n')) fail("WTF"); name = Texts(ns->name, "$", name); + } if (env->id_suffix.length > 0) name = Texts(name, env->id_suffix); + if (Text$has(env->id_suffix, Text("\n"))) fail("WTF?????"); return name; } @@ -113,5 +118,6 @@ Text_t get_id_suffix(const char *filename) { Path_t id_file = Path$child(build_dir, Texts(Path$base_name(path), Text$from_str(".id"))); OptionalText_t id = Path$read(id_file); if (id.tag == TEXT_NONE) err(1, "Could not read ID file: %s", Path$as_c_string(id_file)); + id = Text$trim(id, Text(" \r\n"), true, true); return Texts("$", id); } -- cgit v1.2.3