Module Name: src
Committed By: joerg
Date: Mon Nov 21 15:02:48 UTC 2011
Modified Files:
src/lib/libc/string: wcscspn.c wcspbrk.c wcsspn.c
Log Message:
Clean up a bit in preparation for more serious changes
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/string/wcscspn.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libc/string/wcspbrk.c \
src/lib/libc/string/wcsspn.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/string/wcscspn.c
diff -u src/lib/libc/string/wcscspn.c:1.2 src/lib/libc/string/wcscspn.c:1.3
--- src/lib/libc/string/wcscspn.c:1.2 Wed Jan 3 14:29:36 2001
+++ src/lib/libc/string/wcscspn.c Mon Nov 21 15:02:48 2011
@@ -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:
Index: src/lib/libc/string/wcspbrk.c
diff -u src/lib/libc/string/wcspbrk.c:1.3 src/lib/libc/string/wcspbrk.c:1.4
--- src/lib/libc/string/wcspbrk.c:1.3 Tue Nov 29 03:12:00 2005
+++ src/lib/libc/string/wcspbrk.c Mon Nov 21 15:02:48 2011
@@ -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;
}
Index: src/lib/libc/string/wcsspn.c
diff -u src/lib/libc/string/wcsspn.c:1.3 src/lib/libc/string/wcsspn.c:1.4
--- src/lib/libc/string/wcsspn.c:1.3 Fri Sep 21 16:09:15 2001
+++ src/lib/libc/string/wcsspn.c Mon Nov 21 15:02:48 2011
@@ -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);
}