On 11/03/10 11:29, Chen Guo wrote: > How stupid of me: >> +int > >> +memcoll0 (const char *s1, size_t s1len, const char *s2, size_t s2len) >> +{ >> + int diff; >> + if (!(s1len > 0 && s1[s1len] == '\0')) >> + abort (); >> + if (!(s2len > 0 && s2[s2len] == '\0')) >> + abort (); > > should obviously be s1[s1len - 1] and s2[s2len - 1].
Actually s1[s1len] is right as it is a string length being passed in. The last NUL in the string is not included in the count