mie: func name and args are now specified separately from func creation

func args are added manually using mie_func_add_arg, while the func's name
is specified when the func is added to a module, to allow the module to generate
a unique name.
This commit is contained in:
2025-04-21 21:10:27 +01:00
parent 8febd270ba
commit 8023ea622a
8 changed files with 66 additions and 18 deletions

View File

@@ -151,9 +151,16 @@ struct mie_name *mie_name_map_put(
/* that name already exists, use a suffix to make the name unique.
* alternately, no hint was specified, so it's up to us to generate the name */
b_rope dot = B_ROPE_CHAR('.');
b_rope suffix = B_ROPE_UINT(0);
b_rope unique_name;
b_rope_concat(&unique_name, &base, &suffix);
if (hint) {
const b_rope *parts[] = {&base, &dot, &suffix};
b_rope_join(&unique_name, parts, sizeof parts / sizeof parts[0]);
} else {
b_rope_concat(&unique_name, &base, &suffix);
}
size_t i = 0;
if (!hint || hint[0] == '\0') {
@@ -171,9 +178,12 @@ struct mie_name *mie_name_map_put(
if (B_OK(status)) {
entry->n_str = b_strdup(str);
b_rope_destroy(&unique_name);
return entry;
}
}
b_rope_destroy(&unique_name);
return NULL;
}