bionic: Fix strnlen to work with length of -1
This is used to mean INT_MAX.
This commit is contained in:
parent
a066600558
commit
f82c53bfdc
2 changed files with 5 additions and 2 deletions
2
bionic.c
2
bionic.c
|
@ -697,7 +697,7 @@ int _strlen(const char *s)
|
|||
return i;
|
||||
}
|
||||
|
||||
int _strnlen(const char *s, int maxlen)
|
||||
int _strnlen(const char *s, uint32_t maxlen)
|
||||
{
|
||||
int i = 0;
|
||||
while(s[i++] && i < maxlen);
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef __BIONIC_H__
|
||||
#define __BIONIC_H__
|
||||
#include <stdint.h>
|
||||
|
||||
# define ULONG_MAX 4294967295UL
|
||||
|
||||
size_t _strspn(const char *s1, const char *s2);
|
||||
char * _strpbrk(const char *s1, const char *s2);
|
||||
char *_strtok(char *str, const char *delim, char **saveptr);
|
||||
|
@ -9,7 +12,7 @@ void *_memcpy(void *dst0, const void *src0, size_t length);
|
|||
void _memset(void *dst0, char val, size_t length);
|
||||
unsigned long _strtoul(const void *nptr, void **endptr, int base);
|
||||
int _strlen(const char *s);
|
||||
int _strnlen(const char *s, int maxlen);
|
||||
int _strnlen(const char *s, uint32_t maxlen);
|
||||
|
||||
|
||||
/* ctype replacements */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue