Clean up a bit in preparation for more serious changes
This commit is contained in:
parent
08576413a2
commit
7e173c1846
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wcscspn.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
|
||||
/* $NetBSD: wcscspn.c,v 1.3 2011/11/21 15:02:48 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
|
@ -29,17 +29,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcscspn.c,v 1.2 2001/01/03 14:29:36 lukem Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
__RCSID("$NetBSD: wcscspn.c,v 1.3 2011/11/21 15:02:48 joerg Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
size_t
|
||||
wcscspn(s, set)
|
||||
const wchar_t *s;
|
||||
const wchar_t *set;
|
||||
wcscspn(const wchar_t *s, const wchar_t *set)
|
||||
{
|
||||
const wchar_t *p;
|
||||
const wchar_t *q;
|
||||
|
@ -47,15 +43,11 @@ wcscspn(s, set)
|
|||
_DIAGASSERT(s != NULL);
|
||||
_DIAGASSERT(set != NULL);
|
||||
|
||||
p = s;
|
||||
while (*p) {
|
||||
q = set;
|
||||
while (*q) {
|
||||
for (p = s; *p; ++p) {
|
||||
for (q = set; *q; ++q) {
|
||||
if (*p == *q)
|
||||
goto done;
|
||||
q++;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
done:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wcspbrk.c,v 1.3 2005/11/29 03:12:00 christos Exp $ */
|
||||
/* $NetBSD: wcspbrk.c,v 1.4 2011/11/21 15:02:48 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
|
@ -29,17 +29,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcspbrk.c,v 1.3 2005/11/29 03:12:00 christos Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
__RCSID("$NetBSD: wcspbrk.c,v 1.4 2011/11/21 15:02:48 joerg Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wcspbrk(s, set)
|
||||
const wchar_t *s;
|
||||
const wchar_t *set;
|
||||
wcspbrk(const wchar_t *s, const wchar_t *set)
|
||||
{
|
||||
const wchar_t *p;
|
||||
const wchar_t *q;
|
||||
|
@ -47,15 +43,11 @@ wcspbrk(s, set)
|
|||
_DIAGASSERT(s != NULL);
|
||||
_DIAGASSERT(set != NULL);
|
||||
|
||||
p = s;
|
||||
while (*p) {
|
||||
q = set;
|
||||
while (*q) {
|
||||
for (p = s; *p; ++p) {
|
||||
for (q = set; *q; ++q) {
|
||||
if (*p == *q)
|
||||
return __UNCONST(p);
|
||||
q++;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: wcsspn.c,v 1.3 2001/09/21 16:09:15 yamt Exp $ */
|
||||
/* $NetBSD: wcsspn.c,v 1.4 2011/11/21 15:02:48 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999,2001 Citrus Project,
|
||||
|
@ -29,17 +29,13 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcsspn.c,v 1.3 2001/09/21 16:09:15 yamt Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
__RCSID("$NetBSD: wcsspn.c,v 1.4 2011/11/21 15:02:48 joerg Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
size_t
|
||||
wcsspn(s, set)
|
||||
const wchar_t *s;
|
||||
const wchar_t *set;
|
||||
wcsspn(const wchar_t *s, const wchar_t *set)
|
||||
{
|
||||
const wchar_t *p;
|
||||
const wchar_t *q;
|
||||
|
@ -47,19 +43,14 @@ wcsspn(s, set)
|
|||
_DIAGASSERT(s != NULL);
|
||||
_DIAGASSERT(set != NULL);
|
||||
|
||||
p = s;
|
||||
while (*p) {
|
||||
q = set;
|
||||
while (*q) {
|
||||
for (p = s; *p; ++p) {
|
||||
for (q = set; *q; ++q) {
|
||||
if (*p == *q)
|
||||
break;
|
||||
q++;
|
||||
}
|
||||
if (!*q)
|
||||
goto done;
|
||||
p++;
|
||||
break;
|
||||
}
|
||||
|
||||
done:
|
||||
return (p - s);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue