diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2025-02-05 13:29:05 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2025-02-06 10:38:45 -0500 |
commit | a85565334708840dd44b849a91c1fa09b9038093 (patch) | |
tree | 29599824ab1f5ef02713e558bc68c7f3388c32c8 /src/mtab.c | |
parent | f8aca1c316b116c2de11d42010fdda0ddb418750 (diff) | |
download | bfs-a85565334708840dd44b849a91c1fa09b9038093.tar.xz |
trie: New trie_{get,set}_{str,mem}() functions
Diffstat (limited to 'src/mtab.c')
-rw-r--r-- | src/mtab.c | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -256,10 +256,7 @@ static int bfs_mtab_fill_types(struct bfs_mtab *mtab) { continue; } - struct trie_leaf *leaf = trie_insert_mem(&mtab->types, &sb.dev, sizeof(sb.dev)); - if (leaf) { - leaf->value = mount->type; - } else { + if (trie_set_mem(&mtab->types, &sb.dev, sizeof(sb.dev), mount->type) != 0) { goto fail; } } @@ -282,9 +279,9 @@ const char *bfs_fstype(const struct bfs_mtab *mtab, const struct bfs_stat *statb } } - const struct trie_leaf *leaf = trie_find_mem(&mtab->types, &statbuf->dev, sizeof(statbuf->dev)); - if (leaf) { - return leaf->value; + const char *type = trie_get_mem(&mtab->types, &statbuf->dev, sizeof(statbuf->dev)); + if (type) { + return type; } else { return "unknown"; } |