mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
fix lua strpbrk function skipping the first accept chr lua splash_scroller fix NULL pointer in brk due to lastbreak not being reset on a new line Change-Id: Ica0c9ee5f9194f5be54ab90ad16309adead1c207
17 lines
475 B
C
17 lines
475 B
C
#include "rocklibc.h"
|
|
|
|
#undef strpbrk
|
|
/* custom strbbrk allowing you to define search len of s*/
|
|
const char *strpbrk_n(const char *s, int smax, const char *accept) {
|
|
register int i;
|
|
register const char *a = accept;
|
|
for (i=0; __likely(s[i] && i < smax); i++, a=accept)
|
|
while(__likely(a[0]))
|
|
if ((s[i] == a++[0]))
|
|
return &s[i];
|
|
return NULL;
|
|
}
|
|
|
|
inline char *strpbrk(const char *s, const char *accept) {
|
|
return (char*)strpbrk_n(s, INT_MAX, accept);
|
|
}
|