annotate lib/unistr/u8-strnlen.c @ 12518:b5e42ef33b49

update nearly all FSF copyright year lists to include 2009 The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
author Jim Meyering <meyering@redhat.com>
date Mon, 28 Dec 2009 10:50:36 +0100
parents ad8a75a45dc9
children c2cbabec01dd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7841
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
1 /* Determine bounded length of UTF-8 string.
12518
b5e42ef33b49 update nearly all FSF copyright year lists to include 2009
Jim Meyering <meyering@redhat.com>
parents: 9307
diff changeset
2 Copyright (C) 1999, 2002, 2006, 2009 Free Software Foundation, Inc.
7841
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
3 Written by Bruno Haible <bruno@clisp.org>, 2002.
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
4
9307
ad8a75a45dc9 Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7841
diff changeset
5 This program is free software: you can redistribute it and/or modify it
ad8a75a45dc9 Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7841
diff changeset
6 under the terms of the GNU Lesser General Public License as published
ad8a75a45dc9 Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7841
diff changeset
7 by the Free Software Foundation; either version 3 of the License, or
ad8a75a45dc9 Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7841
diff changeset
8 (at your option) any later version.
7841
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
10 This program is distributed in the hope that it will be useful,
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
9307
ad8a75a45dc9 Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7841
diff changeset
13 Lesser General Public License for more details.
7841
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
14
9307
ad8a75a45dc9 Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7841
diff changeset
15 You should have received a copy of the GNU Lesser General Public License
ad8a75a45dc9 Change copyright notice from LGPLv2.0+ to LGPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 7841
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
7841
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
17
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
18 /* Ensure strnlen() gets declared. */
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
19 #ifndef _GNU_SOURCE
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
20 # define _GNU_SOURCE 1
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
21 #endif
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
22
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
23 #include <config.h>
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
24
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
25 /* Specification. */
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
26 #include "unistr.h"
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
27
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
28 #if __GLIBC__ >= 2
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
29
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
30 # include <string.h>
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
31
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
32 size_t
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
33 u8_strnlen (const uint8_t *s, size_t maxlen)
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
34 {
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
35 return strnlen ((const char *) s, maxlen);
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
36 }
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
37
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
38 #else
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
39
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
40 # define FUNC u8_strnlen
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
41 # define UNIT uint8_t
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
42 # include "u-strnlen.h"
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
43
047ab30cc852 New modules 'unistr/u8-strnlen', 'unistr/u16-strnlen', 'unistr/u32-strnlen'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
44 #endif