чување c37aca66d8af61ed8970eb76ae0a1106f4c17711
родитељ eeb1c782f4c95069332440a9e534884b1d924d1c
Аутор: Страхиња Радић <contact@strahinja.org>
Датум: Sat, 11 Mar 2023 19:56:40 +0100
Bugfix: replace macro u32_is_word_boundary with proper function
Signed-off-by: Страхиња Радић <contact@strahinja.org>
Diffstat:
измењених датотека: 2, додавања: 9(+), брисања: 0(-)
diff --git a/util.c b/util.c
@@ -210,6 +210,14 @@ is_word_boundary(const char ch, const int strictly_whitespace)
}
const int
+u32_is_word_boundary(const uint32_t ch, const int strictly_whitespace)
+{
+ return strictly_whitespace
+ ? u32_strchr((uint32_t*)L" \v\t", ch) != NULL
+ : u32_strchr((uint32_t*)L" \v\t()[]{},.;:/\\", ch) != NULL;
+}
+
+const int
starts_with(const char* s, const char* with)
{
while (*s && *s == *with)
diff --git a/util.h b/util.h
@@ -58,6 +58,7 @@ size_t u32_strcat(uint32_t* to, const uint32_t* from);
size_t u32_strncat(uint32_t* to, const uint32_t* from, size_t max);
size_t u32_u8_strcpy(uint32_t* to, const char* from);
const int is_word_boundary(const char ch, const int strictly_whitespace);
+const int u32_is_word_boundary(const uint32_t ch, const int strictly_whitespace);
const int starts_with(const char* s, const char* with);
const int u32_starts_with(const uint32_t* s, const uint32_t* with);
const char* u8_basename(const char* path);