summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-12-15 14:03:49 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-12-15 14:03:49 -0500
commit6c2963f91b90f73da862ac9feac25cdcc1266869 (patch)
treee5221f7cbcd6829a188186bd7c731f409c17fa76 /util.c
parent4ddf0821a9a24f6e6a6ca60ab6d38e095a88591b (diff)
text insertion working very well!
Diffstat (limited to 'util.c')
-rw-r--r--util.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/util.c b/util.c
index e183461..09da480 100644
--- a/util.c
+++ b/util.c
@@ -33,4 +33,23 @@ static double util_mind(double a, double b) {
return a < b ? a : b;
}
+// for finding a character in a char32 string
+static char32_t *util_mem32chr(char32_t *s, char32_t c, size_t n) {
+ for (size_t i = 0; i < n; ++i) {
+ if (s[i] == c) {
+ return &s[i];
+ }
+ }
+ return NULL;
+}
+
+static char32_t const *util_mem32chr_const(char32_t const *s, char32_t c, size_t n) {
+ for (size_t i = 0; i < n; ++i) {
+ if (s[i] == c) {
+ return &s[i];
+ }
+ }
+ return NULL;
+}
+
#endif