Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/string Clean up a bit in preparation for more serio...



details:   https://anonhg.NetBSD.org/src/rev/fae4a909ea63
branches:  trunk
changeset: 771460:fae4a909ea63
user:      joerg <joerg%NetBSD.org@localhost>
date:      Mon Nov 21 15:02:48 2011 +0000

description:
Clean up a bit in preparation for more serious changes

diffstat:

 lib/libc/string/wcscspn.c |  18 +++++-------------
 lib/libc/string/wcspbrk.c |  18 +++++-------------
 lib/libc/string/wcsspn.c  |  21 ++++++---------------
 3 files changed, 16 insertions(+), 41 deletions(-)

diffs (146 lines):

diff -r 6bd728c8c4d8 -r fae4a909ea63 lib/libc/string/wcscspn.c
--- a/lib/libc/string/wcscspn.c Mon Nov 21 14:39:47 2011 +0000
+++ b/lib/libc/string/wcscspn.c Mon Nov 21 15:02:48 2011 +0000
@@ -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 @@
        _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:
diff -r 6bd728c8c4d8 -r fae4a909ea63 lib/libc/string/wcspbrk.c
--- a/lib/libc/string/wcspbrk.c Mon Nov 21 14:39:47 2011 +0000
+++ b/lib/libc/string/wcspbrk.c Mon Nov 21 15:02:48 2011 +0000
@@ -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 @@
        _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;
 }
diff -r 6bd728c8c4d8 -r fae4a909ea63 lib/libc/string/wcsspn.c
--- a/lib/libc/string/wcsspn.c  Mon Nov 21 14:39:47 2011 +0000
+++ b/lib/libc/string/wcsspn.c  Mon Nov 21 15:02:48 2011 +0000
@@ -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 @@
        _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);
 }



Home | Main Index | Thread Index | Old Index