Better axl_strchr + handle finding '\0'
This commit is contained in:
parent
0d7cfcc8d6
commit
eece39c2ed
1 changed files with 11 additions and 14 deletions
11
axl_string.c
11
axl_string.c
|
|
@ -129,16 +129,13 @@ const i8* axl_strchr(const i8* str, i8 c)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
u32 i = 0;
|
||||
|
||||
while(str[i] != '\0')
|
||||
for(; *str != '\0'; ++str)
|
||||
{
|
||||
if(str[i] == c)
|
||||
if(*str == c)
|
||||
{
|
||||
return str + i;
|
||||
return str;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return (c == '\0') ? str : NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue