Fix memcmp misuse in parsing asm args.

This commit is contained in:
Christoffer Lerno
2025-02-21 09:46:56 +01:00
parent 80e360d8dd
commit b54d994475
4 changed files with 36 additions and 28 deletions

View File

@@ -204,6 +204,18 @@ bool str_has_suffix(const char *name, const char *suffix)
return memcmp(name + name_len - suffix_len, suffix, suffix_len) == 0;
}
bool str_start_with(const char *name, const char *suffix)
{
size_t suffix_len = strlen(suffix);
for (size_t i = 0; i < suffix_len; i++)
{
char c = name[i];
if (c == 0) return false;
if (c != suffix[i]) return false;
}
return true;
}
StringSlice slice_next_token(StringSlice *slice, char separator)
{