From a2da347cfaea54af15455a1621d606b0edc7ad5a Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Tue, 30 Jul 2024 18:51:04 +0200 Subject: Cleanup --- bxgen.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'bxgen.c') diff --git a/bxgen.c b/bxgen.c index 2dc657b..fb58e7d 100755 --- a/bxgen.c +++ b/bxgen.c @@ -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( -- cgit v1.2.3