1 /*
2 FUNCTION
3 <<wcslen>>---get wide-character string length
4
5 SYNOPSIS
6 #include <wchar.h>
7 size_t wcslen(const wchar_t *<[s]>);
8
9 DESCRIPTION
10 The <<wcslen>> function computes the number of wide-character codes
11 in the wide-character string to which <[s]> points, not including the
12 terminating null wide-character code.
13
14 RETURNS
15 The <<wcslen>> function returns the length of <[s]>; no return value is
16 reserved to indicate an error.
17
18 PORTABILITY
19 <<wcslen>> is ISO/IEC 9899/AMD1:1995 (ISO C).
20
21 No supporting OS subroutines are required.
22 */
23
24 /* $NetBSD: wcslen.c,v 1.1 2000/12/23 23:14:36 itojun Exp $ */
25
26 /*-
27 * Copyright (c)1999 Citrus Project,
28 * All rights reserved.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
40 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
42 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
43 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
45 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
48 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
49 * SUCH DAMAGE.
50 *
51 * citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp
52 */
53
54 #include <_ansi.h>
55 #include <wchar.h>
56
57 size_t
wcslen(const wchar_t * s)58 wcslen (const wchar_t * s)
59 {
60 const wchar_t *p;
61
62 p = s;
63 while (*p)
64 p++;
65
66 return p - s;
67 }
68