diff options
author | pommicket <pommicket@gmail.com> | 2024-02-13 09:13:59 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2024-02-13 09:13:59 -0500 |
commit | 12622d7fd3f19936f2d235d8965491eb2adbae80 (patch) | |
tree | 80b667a391c12a297921ac190d7674b48d871de9 | |
parent | 7d1c879163d8e5a061014a18fed1b4f3800b7ae8 (diff) |
handle longer keys/values in .editorconfig
well i found a project somewhere with extremely long
.editorconfig values that aren't documented in the spec
whodathunk!
-rw-r--r-- | config.c | 14 |
1 files changed, 5 insertions, 9 deletions
@@ -1461,7 +1461,7 @@ static void config_read_editorconfig(Ted *ted, RcStr *path_rc) { config_compile_regex(cfg, reader); break; default: { - char key[64] = {c}; + char key[128] = {c}; for (size_t i = 1; i < sizeof key - 1; i++) { c = config_getc(reader); if (!c || c == '\n') break; @@ -1469,18 +1469,14 @@ static void config_read_editorconfig(Ted *ted, RcStr *path_rc) { key[i] = c; } if (c != '=') { - config_err(reader, "expected key = value but didn't find ="); + config_err(reader, "expected key = value but didn't find = (just have %s)", key); break; } str_trim(key); str_ascii_to_lowercase(key); - char value[64] = {0}; - for (size_t i = 0; i < sizeof value - 1; i++) { - c = config_getc(reader); - if (!c || c == '\n') break; - value[i] = c; - } - str_trim(value); + config_read_to_eol(reader, line, sizeof line); + str_trim(line); + char *value = line; if (streq(key, "root")) { str_ascii_to_lowercase(value); if (cfg) { |