comparison src/util.c @ 10:d6f8f73a0c50 v2.1

util: make strnchr an actual strnchr
author Paper <paper@paper.us.eu.org>
date Fri, 22 Mar 2024 20:51:40 -0400
parents 0c98b46eaf73
children 2d7c810a1ac2
comparison
equal deleted inserted replaced
9:21aad49ed2c9 10:d6f8f73a0c50
15 15
16 return len; 16 return len;
17 } 17 }
18 18
19 char* EDL_internal_strnchr(const char* haystack, char needle, size_t length) { 19 char* EDL_internal_strnchr(const char* haystack, char needle, size_t length) {
20 for (; length && *haystack != needle; haystack++, length--); 20 for (; length && *haystack && *haystack != needle; haystack++, length--);
21 21
22 return length ? haystack : NULL; 22 return length ? haystack : NULL;
23 } 23 }
24 24
25 char* EDL_internal_strdup(const char* s) { 25 char* EDL_internal_strdup(const char* s) {