aboutsummaryrefslogtreecommitdiff
path: root/src/modules.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-10-01 12:43:00 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-10-01 12:43:00 -0400
commit6583fe9b389a6b4698f9364945885e6783506886 (patch)
tree0464456d177eab051b03f29a74218a45b301f174 /src/modules.c
parent0cfae753aa131f949253f3fba1e3a36c2bde6ac0 (diff)
Convert to using more zero values for `none`
Diffstat (limited to 'src/modules.c')
-rw-r--r--src/modules.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules.c b/src/modules.c
index 08550f2e..9ebdca09 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -51,7 +51,7 @@ bool install_from_modules_ini(Path_t ini_file, bool ask_confirmation) {
if (by_line.fn == NULL) return false;
OptionalText_t (*next_line)(void *) = by_line.fn;
module_info_t info = {};
- for (Text_t line; (line = next_line(by_line.userdata)).length >= 0;) {
+ for (OptionalText_t line; (line = next_line(by_line.userdata)).tag != TEXT_NONE;) {
char *line_str = Text$as_c_string(line);
const char *next_section = NULL;
if (!strparse(line_str, "[", &next_section, "]")) {
@@ -78,13 +78,13 @@ static void read_modules_ini(Path_t ini_file, module_info_t *info) {
if (by_line.fn == NULL) return;
OptionalText_t (*next_line)(void *) = by_line.fn;
find_section:;
- for (Text_t line; (line = next_line(by_line.userdata)).length >= 0;) {
+ for (OptionalText_t line; (line = next_line(by_line.userdata)).tag != TEXT_NONE;) {
char *line_str = Text$as_c_string(line);
if (line_str[0] == '[' && strncmp(line_str + 1, info->name, strlen(info->name)) == 0
&& line_str[1 + strlen(info->name)] == ']')
break;
}
- for (Text_t line; (line = next_line(by_line.userdata)).length >= 0;) {
+ for (OptionalText_t line; (line = next_line(by_line.userdata)).tag != TEXT_NONE;) {
char *line_str = Text$as_c_string(line);
if (line_str[0] == '[') goto find_section;
if (!strparse(line_str, "version=", &info->version) || !strparse(line_str, "url=", &info->url)
@@ -95,7 +95,7 @@ find_section:;
}
module_info_t get_used_module_info(ast_t *use) {
- static Table_t cache = {};
+ static Table_t cache = EMPTY_TABLE;
TypeInfo_t *cache_type = Table$info(Pointer$info("@", &Memory$info), Pointer$info("@", &Memory$info));
module_info_t **cached = Table$get(cache, &use, cache_type);
if (cached) return **cached;