diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-07-30 18:51:04 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-07-30 18:51:04 +0200 |
commit | a2da347cfaea54af15455a1621d606b0edc7ad5a (patch) | |
tree | 0175a1d2633669ad430f55fe6beb9ca18e182f2d /bxgen.c | |
parent | 17b966facc1e6e0bf00f12148018587e13088d20 (diff) | |
download | bxgen-a2da347cfaea54af15455a1621d606b0edc7ad5a.zip |
Cleanup
Diffstat (limited to 'bxgen.c')
-rwxr-xr-x | bxgen.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -533,7 +533,7 @@ i64 n_call(i64 proc, u16 convention, i64 target_proc, i64 num_args, Var *args); i64 n_call_by_name(i64 proc, u16 convention, c8 *name, i64 num_args, Var *args); i64 n_ret(i64 proc, i64 num_vals, Var *vals); i64 p_new(i64 unit, c8 *name); -i64 p_new_entry(i64 unit, c8 *name); +i64 p_new_entry(i64 unit); void p_add(i64 proc, i64 node); i64 u_new(); void u_add(i64 unit, i64 proc); @@ -3430,14 +3430,16 @@ i64 n_ret(i64 proc, i64 num_vals, Var *vals) { } i64 p_new(i64 unit, c8 *name) { - i64 p = proc_init(&g_pool); - proc_set_name(&g_pool, p, bx_str_len(name, name + MAX_NAME_SIZE), name); + i64 p = proc_init(&g_pool); + i64 len = bx_str_len(name, name + MAX_NAME_SIZE); + if (len > 0) + proc_set_name(&g_pool, p, len, name); u_add(unit, p); return p; } -i64 p_new_entry(i64 unit, c8 *name) { - i64 p = p_new(unit, name); +i64 p_new_entry(i64 unit) { + i64 p = p_new(unit, ""); u_entry_point(unit, p); return p; } @@ -3535,8 +3537,8 @@ int main(int argc, char **argv) { // Add a compilation unit. i64 u = u_new(); - // Add the `main` procedure. - i64 mainproc = p_new_entry(u, "main"); + // Add the entry point. + i64 mainproc = p_new_entry(u); // Initialize libc n_call_by_name( |