diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-15 14:03:49 -0500 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2020-12-15 14:03:49 -0500 |
commit | 6c2963f91b90f73da862ac9feac25cdcc1266869 (patch) | |
tree | e5221f7cbcd6829a188186bd7c731f409c17fa76 /util.c | |
parent | 4ddf0821a9a24f6e6a6ca60ab6d38e095a88591b (diff) |
text insertion working very well!
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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 |