strncmp() stops comparing when either the end of one of the first two
arguments is reached or when 'n' characters have been compared, whichever
comes first.That means that strncmp(s1, s2, n) is equivalent to
strcmp(s1, s2) if n exceeds the length of s1 or the length of s2.
This patch avoids
On 2018/12/18 21:37, Dan Carpenter wrote:
> On Tue, Dec 18, 2018 at 09:25:08PM +0800, YueHaibing wrote:
>> strncmp() stops comparing when either the end of one of the first two
>> arguments is reached or when 'n' characters have been compared, whichever
>> comes first.That means that strncmp(s1,
On Tue, Dec 18, 2018 at 09:25:08PM +0800, YueHaibing wrote:
> strncmp() stops comparing when either the end of one of the first two
> arguments is reached or when 'n' characters have been compared, whichever
> comes first.That means that strncmp(s1, s2, n) is equivalent to
> strcmp(s1, s2) if n