summaryrefslogtreecommitdiff
path: root/libc/string/strspn.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2000-10-07 23:37:03 +0000
committerEric Andersen <andersen@codepoet.org>2000-10-07 23:37:03 +0000
commitfbb4007ac88656122f9319dea4563a3a4fd40e82 (patch)
treeca4265ac43d139b3fd02ba32bfe6d5e12cadb65c /libc/string/strspn.c
parentb8f03a94957c913fa0d8588c41b0332b49310ff0 (diff)
Update and simplification.
Diffstat (limited to 'libc/string/strspn.c')
-rw-r--r--libc/string/strspn.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/libc/string/strspn.c b/libc/string/strspn.c
index 5f64a6f75..70b510a7f 100644
--- a/libc/string/strspn.c
+++ b/libc/string/strspn.c
@@ -22,25 +22,21 @@
/* Return the length of the maximum initial segment
of S which contains only characters in ACCEPT. */
-size_t
-strspn (s, accept)
- const char *s;
- const char *accept;
+size_t strspn( const char *s, const char *accept)
{
- const char *p;
- const char *a;
- size_t count = 0;
-
- for (p = s; *p != '\0'; ++p)
- {
- for (a = accept; *a != '\0'; ++a)
- if (*p == *a)
- break;
- if (*a == '\0')
- return count;
- else
- ++count;
- }
+ const char *p;
+ const char *a;
+ size_t count = 0;
+
+ for (p = s; *p != '\0'; ++p) {
+ for (a = accept; *a != '\0'; ++a)
+ if (*p == *a)
+ break;
+ if (*a == '\0')
+ return count;
+ else
+ ++count;
+ }
- return count;
+ return count;
}