summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2024-07-17 06:59:16 +0200
committerMitya Selivanov <automainint@guattari.tech>2024-07-17 06:59:16 +0200
commit72a1baeff7a9884a643a020a8dbfcd0bdabb8576 (patch)
tree0febf25502cdf136606158b63e05971214c69499
parent1ee34d71dd18a8921fcd62aabf0a4e2f9c2b32b2 (diff)
downloadbxgen-72a1baeff7a9884a643a020a8dbfcd0bdabb8576.zip
Remove bx_str_eq proc
-rwxr-xr-xbxgen.c21
1 files changed, 3 insertions, 18 deletions
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;