diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-11-23 01:29:01 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-11-23 01:29:01 -0500 |
| commit | 5e57bafdaf9d26d9445cc89055563e81e13670d3 (patch) | |
| tree | 881aa5ae33e17dae4436a7da8087d915e458de30 /src | |
| parent | eff8d4aa8c59c4f8c531eb19389041c44aa49941 (diff) | |
Bugfix with ID having a trailing newline
Diffstat (limited to 'src')
| -rw-r--r-- | src/naming.c | 8 |
1 files changed, 7 insertions, 1 deletions
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); } |
