It is really pointless to come up with new implementations of the wide string

functions instead of using the narrow string ones. Make this look like
strchr, so that wcschr(L"foo", L'\0') does not return NULL as it should.
This commit is contained in:
christos 2005-05-30 06:00:01 +00:00
parent a74233676c
commit 524267d3f8
1 changed files with 9 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: wcschr.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
/* $NetBSD: wcschr.c,v 1.3 2005/05/30 06:00:01 christos Exp $ */
/*-
* Copyright (c)1999 Citrus Project,
@ -30,28 +30,25 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: wcschr.c,v 1.2 2001/01/03 14:29:36 lukem Exp $");
__RCSID("$NetBSD: wcschr.c,v 1.3 2005/05/30 06:00:01 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
#include <wchar.h>
wchar_t *
wcschr(s, c)
const wchar_t *s;
wchar_t c;
wcschr(const wchar_t *p, wchar_t c)
{
const wchar_t *p;
_DIAGASSERT(p != NULL);
_DIAGASSERT(s != NULL);
p = s;
while (*p) {
for (;; ++p) {
if (*p == c) {
/* LINTED interface specification */
return (wchar_t *)p;
return __UNCONST(p);
}
if (!*p)
return NULL;
p++;
}
return NULL;
/*NOTREACHED*/
}