From 72a1baeff7a9884a643a020a8dbfcd0bdabb8576 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Wed, 17 Jul 2024 06:59:16 +0200 Subject: Remove bx_str_eq proc --- bxgen.c | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'bxgen.c') diff --git a/bxgen.c b/bxgen.c index d1f0771..594216c 100755 --- a/bxgen.c +++ b/bxgen.c @@ -513,21 +513,6 @@ i64 bx_str_len(c8 *s, c8 *s_max) { BX_FAIL("Buffer overflow", 0); } -b8 bx_str_eq( - c8 *a, c8 *a_end, - c8 *b, c8 *b_end -) { - BX_CHECK(a != NULL && a_end != NULL, "Invalid arguments", 0); - BX_CHECK(b != NULL && b_end != NULL, "Invalid arguments", 0); - - while (*a == *b && a != a_end && b != b_end) { - ++a; - ++b; - } - - return a == a_end && b == b_end; -} - c8 *bx_find_char(c8 *s, c8 *s_end, c8 c) { BX_CHECK(s != NULL, "Invalid arguments", NULL); BX_CHECK(s_end != NULL, "Invalid arguments", NULL); @@ -1695,7 +1680,7 @@ void unit_write(Pool *pool, i64 unit, u16 target, i64 io_out, void *io_user_data BX_CHECK(end[0] == '\x60', "",); BX_CHECK(end[1] == '\x0a', "",); - if (bx_str_eq(id, id + 16, AR_SYMBOL_TABLE, AR_SYMBOL_TABLE + 16)) { + if (bx_mem_eq(id, AR_SYMBOL_TABLE, 16)) { // AR symbol table // @@ -1749,7 +1734,7 @@ void unit_write(Pool *pool, i64 unit, u16 target, i64 io_out, void *io_user_data io_seek(f, 1, IO_SEEK_CURSOR, io_user_data); current_offset += 1; } - } else if (bx_str_eq(id, id + 16, AR_STRING_TABLE, AR_STRING_TABLE + 16)) { + } else if (bx_mem_eq(id, AR_STRING_TABLE, 16)) { // String table // @@ -1936,7 +1921,7 @@ void unit_write(Pool *pool, i64 unit, u16 target, i64 io_out, void *io_user_data c8 buf[8]; n = io_read(f, sizeof buf, buf, io_user_data); if (n == 0) break; - if (!bx_str_eq(buf, buf + 7, STRTAB, STRTAB + 7)) + if (!bx_mem_eq(buf, STRTAB, 7)) continue; symbol_names_offset = offset; -- cgit v1.2.3