mailing list of musl libc
 help / color / mirror / code / Atom feed
* A bug in wcsncmp.c
@ 2012-05-26 21:17 Richard Pennington
  0 siblings, 0 replies; only message in thread
From: Richard Pennington @ 2012-05-26 21:17 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 213 bytes --]

n wasn't getting decremented.

Fix:

#include <wchar.h>

int wcsncmp(const wchar_t *l, const wchar_t *r, size_t n)
{
        for (; n && *l==*r && *l && *r; n--, l++, r++);
        return n ? *l - *r : 0;
}

-Rich

[-- Attachment #2: Type: text/html, Size: 2495 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-26 21:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-26 21:17 A bug in wcsncmp.c Richard Pennington

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).