string: always call strcmp() in nstrcmp()

Some people seem to depend on the unstandardized
behavior of some (notably glibc) implementations
of strcmp() where the arithemtic difference
between s1 and s2 is returned, not just any
positive or negative number.  This is explicitly
undocumented in libneo as well, but still doing
it won't hurt either.
main
anna 3 years ago
parent 7d64438f70
commit 8c591796fb
Signed by: fef
GPG Key ID: EC22E476DC2D3D84

@ -22,13 +22,13 @@ int nstrcmp(const string *s1, const string *s2, error *err)
int ret;
if (nlen(s1) > nlen(s2))
ret = 1;
else if (nlen(s1) < nlen(s2))
ret = -1;
usize maxbytes;
if (s1->_capacity > s2->_capacity)
maxbytes = s2->_capacity;
else
ret = strcmp(s1->_data, s2->_data);
maxbytes = s1->_capacity;
ret = strncmp(s1->_data, s2->_data, maxbytes);
neat(err);
return ret;
}

Loading…
Cancel
Save