util/stringops: use strncmp for strendswith (#362)
Minor change, doesn't really fix anything. Similar to strstartswith, it may be better to use strncmp instead of looping through every char in a string.
This commit is contained in:
parent
a5678791a4
commit
2d47ab0fe7
1 changed files with 1 additions and 5 deletions
|
@ -19,11 +19,7 @@ bool strendswith(const char *s, const char *e) {
|
|||
if(le > ls)
|
||||
return false;
|
||||
|
||||
int i; for(i = 0; i < le; ++i)
|
||||
if(s[ls-i-1] != e[le-i-1])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return !strncmp(s+ls-le, e, le);
|
||||
}
|
||||
|
||||
bool strstartswith(const char *s, const char *p) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue