Libraries updates and cleanup
* Updating common/lib * Updating lib/csu * Updating lib/libc * Updating libexec/ld.elf_so * Corrected test on __minix in featuretest to actually follow the meaning of the comment. * Cleaned up _REENTRANT-related defintions. * Disabled -D_REENTRANT for libfetch * Removing some unneeded __NBSD_LIBC defines and tests Change-Id: Ic1394baef74d11b9f86b312f5ff4bbc3cbf72ce2
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
# from: @(#)Makefile.inc 8.1 (Berkeley) 6/4/93
|
||||
# $NetBSD: Makefile.inc,v 1.75 2009/07/30 20:57:15 dsl Exp $
|
||||
# $NetBSD: Makefile.inc,v 1.76 2012/08/30 12:16:48 drochner Exp $
|
||||
|
||||
# string sources
|
||||
.PATH: ${ARCHDIR}/string ${.CURDIR}/string
|
||||
@@ -19,6 +19,7 @@ SRCS+= bcmp.c bcopy.c bzero.c ffs.c memchr.c memcmp.c memset.c
|
||||
SRCS+= strcat.c strcmp.c strcpy.c strcspn.c strlen.c
|
||||
SRCS+= strncat.c strncmp.c strncpy.c strpbrk.c strsep.c
|
||||
SRCS+= strspn.c strstr.c swab.c
|
||||
SRCS+= explicit_bzero.c consttime_bcmp.c
|
||||
|
||||
SRCS+= memccpy.c memcpy.c memmem.c memmove.c
|
||||
SRCS+= strchr.c strrchr.c
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: __strsignal.c,v 1.24 2003/08/07 16:43:46 agc Exp $ */
|
||||
/* $NetBSD: __strsignal.c,v 1.25 2012/03/20 17:44:18 matt Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: __strsignal.c,v 1.24 2003/08/07 16:43:46 agc Exp $");
|
||||
__RCSID("$NetBSD: __strsignal.c,v 1.25 2012/03/20 17:44:18 matt Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -56,10 +56,7 @@ __RCSID("$NetBSD: __strsignal.c,v 1.24 2003/08/07 16:43:46 agc Exp $");
|
||||
|
||||
/* ARGSUSED */
|
||||
const char *
|
||||
__strsignal(num, buf, buflen)
|
||||
int num;
|
||||
char *buf;
|
||||
size_t buflen;
|
||||
__strsignal(int num, char *buf, size_t buflen)
|
||||
{
|
||||
#define UPREFIX "Unknown signal: %u"
|
||||
#define RPREFIX "Real time signal %u"
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)bcmp.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $NetBSD: bcmp.3,v 1.13 2010/04/29 06:54:26 jruoho Exp $
|
||||
.\" $NetBSD: bcmp.3,v 1.14 2012/05/05 21:24:19 dholland Exp $
|
||||
.\"
|
||||
.Dd April 29, 2010
|
||||
.Dd May 5, 2012
|
||||
.Dt BCMP 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -57,6 +57,11 @@ bytes long.
|
||||
Zero-length strings are always identical.
|
||||
.Pp
|
||||
The strings may overlap.
|
||||
.Pp
|
||||
This function is obsolete.
|
||||
The equivalent function
|
||||
.Xr memcmp 3
|
||||
should be used instead.
|
||||
.Sh SEE ALSO
|
||||
.Xr memcmp 3 ,
|
||||
.Xr strcasecmp 3 ,
|
||||
|
||||
@@ -29,9 +29,9 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)bcopy.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $NetBSD: bcopy.3,v 1.13 2010/04/29 07:27:30 wiz Exp $
|
||||
.\" $NetBSD: bcopy.3,v 1.14 2012/05/05 21:24:19 dholland Exp $
|
||||
.\"
|
||||
.Dd April 29, 2010
|
||||
.Dd May 5, 2012
|
||||
.Dt BCOPY 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -57,6 +57,20 @@ The two strings may overlap.
|
||||
If
|
||||
.Fa len
|
||||
is zero, no bytes are copied.
|
||||
.Pp
|
||||
This function is obsolete.
|
||||
The functions
|
||||
.Xr memcpy 3
|
||||
and/or
|
||||
.Xr memmove 3
|
||||
should be used instead.
|
||||
Note that
|
||||
.Fn bcopy
|
||||
takes its
|
||||
.Fa src
|
||||
and
|
||||
.Fa dst
|
||||
arguments in the opposite order from these.
|
||||
.Sh SEE ALSO
|
||||
.Xr memccpy 3 ,
|
||||
.Xr memcpy 3 ,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bm.c,v 1.11 2003/08/07 16:43:47 agc Exp $ */
|
||||
/* $NetBSD: bm.c,v 1.12 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
@@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)bm.c 8.7 (Berkeley) 6/21/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: bm.c,v 1.11 2003/08/07 16:43:47 agc Exp $");
|
||||
__RCSID("$NetBSD: bm.c,v 1.12 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS && not lint */
|
||||
|
||||
@@ -100,10 +100,7 @@ static u_char const freq_def[256] = {
|
||||
};
|
||||
|
||||
bm_pat *
|
||||
bm_comp(pb, len, freq)
|
||||
u_char const *pb;
|
||||
size_t len;
|
||||
u_char const *freq;
|
||||
bm_comp(u_char const *pb, size_t len, u_char const *freq)
|
||||
{
|
||||
u_char const *pe, *p;
|
||||
size_t *d, r;
|
||||
@@ -160,8 +157,7 @@ mem: sv_errno = errno;
|
||||
}
|
||||
|
||||
void
|
||||
bm_free(pat)
|
||||
bm_pat *pat;
|
||||
bm_free(bm_pat *pat)
|
||||
{
|
||||
|
||||
_DIAGASSERT(pat != NULL);
|
||||
@@ -174,10 +170,7 @@ bm_free(pat)
|
||||
}
|
||||
|
||||
u_char *
|
||||
bm_exec(pat, base, n)
|
||||
bm_pat *pat;
|
||||
u_char *base;
|
||||
size_t n;
|
||||
bm_exec(bm_pat *pat, u_char *base, size_t n)
|
||||
{
|
||||
u_char *e, *ep, *p, *q, *s;
|
||||
size_t *d0, k, md2, n1, ro;
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)index.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $NetBSD: index.3,v 1.13 2010/04/29 06:54:26 jruoho Exp $
|
||||
.\" $NetBSD: index.3,v 1.15 2012/05/05 21:18:43 dholland Exp $
|
||||
.\"
|
||||
.Dd April 29, 2010
|
||||
.Dd May 5, 2012
|
||||
.Dt INDEX 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -52,6 +52,11 @@ locates the first character matching
|
||||
.Em char )
|
||||
in the nul-terminated string
|
||||
.Fa s .
|
||||
.Pp
|
||||
This function is obsolete.
|
||||
The equivalent function
|
||||
.Xr strchr 3
|
||||
should be used instead.
|
||||
.Sh RETURN VALUES
|
||||
A pointer to the character is returned if it is found; otherwise
|
||||
.Dv NULL
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: memccpy.c,v 1.12 2003/08/07 16:43:48 agc Exp $ */
|
||||
/* $NetBSD: memccpy.c,v 1.13 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)memccpy.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: memccpy.c,v 1.12 2003/08/07 16:43:48 agc Exp $");
|
||||
__RCSID("$NetBSD: memccpy.c,v 1.13 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -42,11 +42,7 @@ __RCSID("$NetBSD: memccpy.c,v 1.12 2003/08/07 16:43:48 agc Exp $");
|
||||
#include <string.h>
|
||||
|
||||
void *
|
||||
memccpy(t, f, c, n)
|
||||
void *t;
|
||||
const void *f;
|
||||
int c;
|
||||
size_t n;
|
||||
memccpy(void *t, const void *f, int c, size_t n)
|
||||
{
|
||||
|
||||
_DIAGASSERT(t != 0);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: popcount.3,v 1.4 2009/07/22 07:07:27 wiz Exp $
|
||||
.\" $NetBSD: popcount.3,v 1.5 2011/08/22 01:36:04 dholland Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@@ -27,7 +27,7 @@
|
||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd July 13, 2009
|
||||
.Dd August 22, 2011
|
||||
.Dt POPCOUNT 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -47,6 +47,7 @@
|
||||
.Fn popcountl "unsigned long value"
|
||||
.Ft unsigned int
|
||||
.Fn popcountll "unsigned long long value"
|
||||
.In stdint.h
|
||||
.Ft unsigned int
|
||||
.Fn popcount32 "uint32_t value"
|
||||
.Ft unsigned int
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" from: @(#)rindex.3 8.1 (Berkeley) 6/4/93
|
||||
.\" $NetBSD: rindex.3,v 1.12 2010/04/29 06:54:26 jruoho Exp $
|
||||
.\" $NetBSD: rindex.3,v 1.14 2012/05/05 21:18:43 dholland Exp $
|
||||
.\"
|
||||
.Dd April 29, 2010
|
||||
.Dd May 5, 2012
|
||||
.Dt RINDEX 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
@@ -53,6 +53,11 @@ matching
|
||||
.Em char )
|
||||
in the nul-terminated string
|
||||
.Fa s .
|
||||
.Pp
|
||||
This function is obsolete.
|
||||
The equivalent function
|
||||
.Xr strrchr 3
|
||||
should be used instead.
|
||||
.Sh RETURN VALUES
|
||||
A pointer to the character is returned if it is found; otherwise
|
||||
.Dv NULL
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strcoll.c,v 1.9 2003/08/07 16:43:50 agc Exp $ */
|
||||
/* $NetBSD: strcoll.c,v 1.10 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strcoll.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strcoll.c,v 1.9 2003/08/07 16:43:50 agc Exp $");
|
||||
__RCSID("$NetBSD: strcoll.c,v 1.10 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -48,8 +48,7 @@ __RCSID("$NetBSD: strcoll.c,v 1.9 2003/08/07 16:43:50 agc Exp $");
|
||||
* Compare strings according to LC_COLLATE category of current locale.
|
||||
*/
|
||||
int
|
||||
strcoll(s1, s2)
|
||||
const char *s1, *s2;
|
||||
strcoll(const char *s1, const char *s2)
|
||||
{
|
||||
|
||||
_DIAGASSERT(s1 != NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strcspn.c,v 1.17 2009/07/30 21:42:06 dsl Exp $ */
|
||||
/* $NetBSD: strcspn.c,v 1.18 2012/03/21 00:35:50 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 Joerg Sonnenberger
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: strcspn.c,v 1.17 2009/07/30 21:42:06 dsl Exp $");
|
||||
__RCSID("$NetBSD: strcspn.c,v 1.18 2012/03/21 00:35:50 christos Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
@@ -39,7 +39,7 @@ __RCSID("$NetBSD: strcspn.c,v 1.17 2009/07/30 21:42:06 dsl Exp $");
|
||||
size_t
|
||||
strcspn(const char *s, const char *charset)
|
||||
{
|
||||
static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
|
||||
static const uint8_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
|
||||
const char *t;
|
||||
uint8_t set[32];
|
||||
#define UC(a) ((unsigned int)(unsigned char)(a))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strdup.c,v 1.13 2003/08/07 16:43:50 agc Exp $ */
|
||||
/* $NetBSD: strdup.c,v 1.14 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strdup.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strdup.c,v 1.13 2003/08/07 16:43:50 agc Exp $");
|
||||
__RCSID("$NetBSD: strdup.c,v 1.14 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -50,8 +50,7 @@ __weak_alias(strdup,_strdup)
|
||||
#endif
|
||||
|
||||
char *
|
||||
strdup(str)
|
||||
const char *str;
|
||||
strdup(const char *str)
|
||||
{
|
||||
size_t len;
|
||||
char *copy;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strmode.c,v 1.18 2006/10/07 22:04:18 apb Exp $ */
|
||||
/* $NetBSD: strmode.c,v 1.19 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -38,7 +38,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strmode.c 8.3 (Berkeley) 8/15/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: strmode.c,v 1.18 2006/10/07 22:04:18 apb Exp $");
|
||||
__RCSID("$NetBSD: strmode.c,v 1.19 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strncat.c,v 1.11 2007/06/03 17:39:27 christos Exp $ */
|
||||
/* $NetBSD: strncat.c,v 1.12 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strncat.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strncat.c,v 1.11 2007/06/03 17:39:27 christos Exp $");
|
||||
__RCSID("$NetBSD: strncat.c,v 1.12 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -53,10 +53,7 @@ __RCSID("$NetBSD: strncat.c,v 1.11 2007/06/03 17:39:27 christos Exp $");
|
||||
* are written at dst (at most n+1 bytes being appended). Return dst.
|
||||
*/
|
||||
char *
|
||||
strncat(dst, src, n)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t n;
|
||||
strncat(char *dst, const char *src, size_t n)
|
||||
{
|
||||
|
||||
_DIAGASSERT(dst != NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strpbrk.c,v 1.19 2008/09/24 16:58:53 christos Exp $ */
|
||||
/* $NetBSD: strpbrk.c,v 1.20 2011/11/22 00:37:09 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 Joerg Sonnenberger
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: strpbrk.c,v 1.19 2008/09/24 16:58:53 christos Exp $");
|
||||
__RCSID("$NetBSD: strpbrk.c,v 1.20 2011/11/22 00:37:09 joerg Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
@@ -60,6 +60,11 @@ strpbrk(const char *s, const char *charset)
|
||||
_DIAGASSERT(s != NULL);
|
||||
_DIAGASSERT(charset != NULL);
|
||||
|
||||
if (charset[0] == '\0')
|
||||
return NULL;
|
||||
if (charset[1] == '\0')
|
||||
return strchr(s, charset[0]);
|
||||
|
||||
for (; *charset != '\0'; ++charset)
|
||||
ADD_TO_SET(UC(*charset));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strsignal.c,v 1.14 2009/07/22 19:48:27 kleink Exp $ */
|
||||
/* $NetBSD: strsignal.c,v 1.15 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char *sccsid = "@(#)strerror.c 5.6 (Berkeley) 5/4/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: strsignal.c,v 1.14 2009/07/22 19:48:27 kleink Exp $");
|
||||
__RCSID("$NetBSD: strsignal.c,v 1.15 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -48,8 +48,7 @@ __weak_alias(strsignal,_strsignal)
|
||||
#endif
|
||||
|
||||
__aconst char *
|
||||
strsignal(sig)
|
||||
int sig;
|
||||
strsignal(int sig)
|
||||
{
|
||||
static char buf[NL_TEXTMAX];
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strspn.c,v 1.17 2009/07/30 21:42:06 dsl Exp $ */
|
||||
/* $NetBSD: strspn.c,v 1.18 2012/03/21 00:35:50 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008 Joerg Sonnenberger
|
||||
@@ -26,7 +26,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__RCSID("$NetBSD: strspn.c,v 1.17 2009/07/30 21:42:06 dsl Exp $");
|
||||
__RCSID("$NetBSD: strspn.c,v 1.18 2012/03/21 00:35:50 christos Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
@@ -38,7 +38,7 @@ __RCSID("$NetBSD: strspn.c,v 1.17 2009/07/30 21:42:06 dsl Exp $");
|
||||
size_t
|
||||
strspn(const char *s, const char *charset)
|
||||
{
|
||||
static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
|
||||
static const uint8_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 };
|
||||
uint8_t set[32];
|
||||
const char *t;
|
||||
#define UC(a) ((unsigned int)(unsigned char)(a))
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strtok_r.c,v 1.9 2003/08/07 16:43:53 agc Exp $ */
|
||||
/* $NetBSD: strtok_r.c,v 1.10 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 Regents of the University of California.
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char *sccsid = "@(#)strtok.c 5.8 (Berkeley) 2/24/91";
|
||||
#else
|
||||
__RCSID("$NetBSD: strtok_r.c,v 1.9 2003/08/07 16:43:53 agc Exp $");
|
||||
__RCSID("$NetBSD: strtok_r.c,v 1.10 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -48,10 +48,7 @@ __weak_alias(strtok_r,_strtok_r)
|
||||
#endif
|
||||
|
||||
char *
|
||||
strtok_r(s, delim, lasts)
|
||||
char *s;
|
||||
const char *delim;
|
||||
char **lasts;
|
||||
strtok_r(char *s, const char *delim, char **lasts)
|
||||
{
|
||||
const char *spanp;
|
||||
int c, sc;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: strxfrm.c,v 1.11 2003/08/07 16:43:53 agc Exp $ */
|
||||
/* $NetBSD: strxfrm.c,v 1.12 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strxfrm.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: strxfrm.c,v 1.11 2003/08/07 16:43:53 agc Exp $");
|
||||
__RCSID("$NetBSD: strxfrm.c,v 1.12 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -50,10 +50,7 @@ __RCSID("$NetBSD: strxfrm.c,v 1.11 2003/08/07 16:43:53 agc Exp $");
|
||||
* on the original untransformed strings would return.
|
||||
*/
|
||||
size_t
|
||||
strxfrm(dst, src, n)
|
||||
char *dst;
|
||||
const char *src;
|
||||
size_t n;
|
||||
strxfrm(char *dst, const char *src, size_t n)
|
||||
{
|
||||
size_t srclen, copysize;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcscat.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
|
||||
/* $NetBSD: wcscat.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,16 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcscat.c,v 1.2 2001/01/03 14:29:36 lukem Exp $");
|
||||
__RCSID("$NetBSD: wcscat.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wcscat(s1, s2)
|
||||
wchar_t *s1;
|
||||
const wchar_t *s2;
|
||||
wcscat(wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
wchar_t *p;
|
||||
wchar_t *q;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcscmp.c,v 1.8 2009/01/11 02:46:30 christos Exp $ */
|
||||
/* $NetBSD: wcscmp.c,v 1.9 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
@@ -37,7 +37,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: wcscmp.c,v 1.8 2009/01/11 02:46:30 christos Exp $");
|
||||
__RCSID("$NetBSD: wcscmp.c,v 1.9 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -49,8 +49,7 @@ __RCSID("$NetBSD: wcscmp.c,v 1.8 2009/01/11 02:46:30 christos Exp $");
|
||||
* Compare strings.
|
||||
*/
|
||||
int
|
||||
wcscmp(s1, s2)
|
||||
const wchar_t *s1, *s2;
|
||||
wcscmp(const wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
|
||||
_DIAGASSERT(s1 != NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcscpy.c,v 1.3 2005/10/13 21:13:05 tnozaki Exp $ */
|
||||
/* $NetBSD: wcscpy.c,v 1.4 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,16 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcscpy.c,v 1.3 2005/10/13 21:13:05 tnozaki Exp $");
|
||||
__RCSID("$NetBSD: wcscpy.c,v 1.4 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wcscpy(s1, s2)
|
||||
wchar_t *s1;
|
||||
const wchar_t *s2;
|
||||
wcscpy(wchar_t *s1, const wchar_t *s2)
|
||||
{
|
||||
wchar_t *p;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* $NetBSD: wcscspn.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
|
||||
/* $NetBSD: wcscspn.c,v 1.4 2011/11/24 18:44:25 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
* Copyright (c) 1999 Citrus Project,
|
||||
* Copyright (c) 2011 Joerg Sonnenberger,
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,33 +30,45 @@
|
||||
*/
|
||||
|
||||
#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.4 2011/11/24 18:44:25 joerg Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "wcscspn_bloom.h"
|
||||
|
||||
size_t
|
||||
wcscspn(s, set)
|
||||
const wchar_t *s;
|
||||
const wchar_t *set;
|
||||
wcscspn(const wchar_t *s, const wchar_t *set)
|
||||
{
|
||||
size_t bloom[BLOOM_ARRAY_SIZE];
|
||||
const wchar_t *p;
|
||||
const wchar_t *q;
|
||||
|
||||
_DIAGASSERT(s != NULL);
|
||||
_DIAGASSERT(set != NULL);
|
||||
|
||||
p = s;
|
||||
while (*p) {
|
||||
if (set[0] == '\0')
|
||||
return wcslen(s);
|
||||
if (set[1] == '\0') {
|
||||
for (p = s; *p; ++p)
|
||||
if (*p == set[0])
|
||||
break;
|
||||
return p - s;
|
||||
}
|
||||
|
||||
wcsspn_bloom_init(bloom, set);
|
||||
|
||||
for (p = s; *p; ++p) {
|
||||
if (!wcsspn_in_bloom(bloom, *p))
|
||||
continue;
|
||||
|
||||
q = set;
|
||||
while (*q) {
|
||||
do {
|
||||
if (*p == *q)
|
||||
goto done;
|
||||
q++;
|
||||
}
|
||||
p++;
|
||||
} while (*++q);
|
||||
}
|
||||
|
||||
done:
|
||||
|
||||
86
lib/libc/string/wcscspn_bloom.h
Normal file
86
lib/libc/string/wcscspn_bloom.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/* $NetBSD: wcscspn_bloom.h,v 1.4 2011/11/25 17:48:22 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2011 Joerg Sonnenberger,
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Bloom filter for fast test if a given character is part of the reject set.
|
||||
* The test may have false positives, but doesn't have false negatives.
|
||||
* The first hash function is designed to be very fast to evaluate.
|
||||
* It is collision free if the input is part of the same European language
|
||||
* and shouldn't be too bad even other input. The second hash function
|
||||
* tries to provide a much better mixing, but involves the slower
|
||||
* multiplication.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
#define BLOOM_SIZE 64
|
||||
#define BLOOM_ARRAY_SIZE (BLOOM_SIZE / sizeof(size_t))
|
||||
#define BLOOM_BITS (BLOOM_SIZE * CHAR_BIT)
|
||||
#define BLOOM_DIV (sizeof(size_t) * CHAR_BIT)
|
||||
|
||||
static inline size_t
|
||||
wcscspn_bloom1(size_t x)
|
||||
{
|
||||
return x % BLOOM_BITS;
|
||||
}
|
||||
|
||||
static inline size_t
|
||||
wcscspn_bloom2(size_t x)
|
||||
{
|
||||
return (size_t)((uint32_t)(x * 2654435761U) /
|
||||
(0x100000000ULL / BLOOM_BITS));
|
||||
}
|
||||
|
||||
static inline void
|
||||
wcsspn_bloom_init(size_t *bloom, const wchar_t *charset)
|
||||
{
|
||||
size_t val;
|
||||
|
||||
memset(bloom, 0, BLOOM_SIZE);
|
||||
do {
|
||||
val = wcscspn_bloom1((size_t)*charset);
|
||||
bloom[val / BLOOM_DIV] |= (size_t)1 << (val % BLOOM_DIV);
|
||||
val = wcscspn_bloom2((size_t)*charset);
|
||||
bloom[val / BLOOM_DIV] |= (size_t)1 << (val % BLOOM_DIV);
|
||||
}
|
||||
while (*++charset);
|
||||
}
|
||||
|
||||
static inline int
|
||||
wcsspn_in_bloom(const size_t *bloom, wchar_t ch)
|
||||
{
|
||||
size_t val;
|
||||
|
||||
val = wcscspn_bloom1((size_t)ch);
|
||||
if (bloom[val / BLOOM_DIV] & ((size_t)1 << (val % BLOOM_DIV)))
|
||||
return 1;
|
||||
val = wcscspn_bloom2((size_t)ch);
|
||||
if (bloom[val / BLOOM_DIV] & ((size_t)1 << (val % BLOOM_DIV)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcslcat.c,v 1.2 2001/01/03 14:33:02 lukem Exp $ */
|
||||
/* $NetBSD: wcslcat.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
/* from OpenBSD: strlcat.c,v 1.3 2000/11/24 11:10:02 itojun Exp */
|
||||
|
||||
/*
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcslcat.c,v 1.2 2001/01/03 14:33:02 lukem Exp $");
|
||||
__RCSID("$NetBSD: wcslcat.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -45,10 +45,7 @@ __RCSID("$NetBSD: wcslcat.c,v 1.2 2001/01/03 14:33:02 lukem Exp $");
|
||||
* truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
wcslcat(dst, src, siz)
|
||||
wchar_t *dst;
|
||||
const wchar_t *src;
|
||||
size_t siz;
|
||||
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
|
||||
{
|
||||
wchar_t *d = dst;
|
||||
const wchar_t *s = src;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcslcpy.c,v 1.2 2001/01/03 14:33:02 lukem Exp $ */
|
||||
/* $NetBSD: wcslcpy.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
/* from OpenBSD: strlcpy.c,v 1.4 1999/05/01 18:56:41 millert Exp */
|
||||
|
||||
/*
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcslcpy.c,v 1.2 2001/01/03 14:33:02 lukem Exp $");
|
||||
__RCSID("$NetBSD: wcslcpy.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@@ -43,10 +43,7 @@ __RCSID("$NetBSD: wcslcpy.c,v 1.2 2001/01/03 14:33:02 lukem Exp $");
|
||||
* Returns wcslen(src); if retval >= siz, truncation occurred.
|
||||
*/
|
||||
size_t
|
||||
wcslcpy(dst, src, siz)
|
||||
wchar_t *dst;
|
||||
const wchar_t *src;
|
||||
size_t siz;
|
||||
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
|
||||
{
|
||||
wchar_t *d = dst;
|
||||
const wchar_t *s = src;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcslen.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
|
||||
/* $NetBSD: wcslen.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,15 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcslen.c,v 1.2 2001/01/03 14:29:36 lukem Exp $");
|
||||
__RCSID("$NetBSD: wcslen.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
size_t
|
||||
wcslen(s)
|
||||
const wchar_t *s;
|
||||
wcslen(const wchar_t *s)
|
||||
{
|
||||
const wchar_t *p;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcsncat.c,v 1.2 2001/01/03 14:29:36 lukem Exp $ */
|
||||
/* $NetBSD: wcsncat.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,17 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcsncat.c,v 1.2 2001/01/03 14:29:36 lukem Exp $");
|
||||
__RCSID("$NetBSD: wcsncat.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wcsncat(s1, s2, n)
|
||||
wchar_t *s1;
|
||||
const wchar_t *s2;
|
||||
size_t n;
|
||||
wcsncat(wchar_t *s1, const wchar_t *s2, size_t n)
|
||||
{
|
||||
wchar_t *p;
|
||||
wchar_t *q;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcsncmp.c,v 1.8 2009/01/11 02:46:30 christos Exp $ */
|
||||
/* $NetBSD: wcsncmp.c,v 1.9 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@@ -34,7 +34,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: wcsncmp.c,v 1.8 2009/01/11 02:46:30 christos Exp $");
|
||||
__RCSID("$NetBSD: wcsncmp.c,v 1.9 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
@@ -43,9 +43,7 @@ __RCSID("$NetBSD: wcsncmp.c,v 1.8 2009/01/11 02:46:30 christos Exp $");
|
||||
#include "runetype_local.h"
|
||||
|
||||
int
|
||||
wcsncmp(s1, s2, n)
|
||||
const wchar_t *s1, *s2;
|
||||
size_t n;
|
||||
wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
|
||||
{
|
||||
|
||||
_DIAGASSERT(s1 != NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcsncpy.c,v 1.3 2005/10/13 21:13:05 tnozaki Exp $ */
|
||||
/* $NetBSD: wcsncpy.c,v 1.4 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,17 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcsncpy.c,v 1.3 2005/10/13 21:13:05 tnozaki Exp $");
|
||||
__RCSID("$NetBSD: wcsncpy.c,v 1.4 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wcsncpy(s1, s2, n)
|
||||
wchar_t *s1;
|
||||
const wchar_t *s2;
|
||||
size_t n;
|
||||
wcsncpy(wchar_t *s1, const wchar_t *s2, size_t n)
|
||||
{
|
||||
wchar_t *p;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/* $NetBSD: wcspbrk.c,v 1.3 2005/11/29 03:12:00 christos Exp $ */
|
||||
/* $NetBSD: wcspbrk.c,v 1.5 2011/11/24 18:44:25 joerg Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
* Copyright (c) 1999 Citrus Project,
|
||||
* Copyright (c) 2011 Joerg Sonnenberger,
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,33 +30,41 @@
|
||||
*/
|
||||
|
||||
#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.5 2011/11/24 18:44:25 joerg Exp $");
|
||||
|
||||
#include <assert.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "wcscspn_bloom.h"
|
||||
|
||||
wchar_t *
|
||||
wcspbrk(s, set)
|
||||
const wchar_t *s;
|
||||
const wchar_t *set;
|
||||
wcspbrk(const wchar_t *s, const wchar_t *set)
|
||||
{
|
||||
size_t bloom[BLOOM_ARRAY_SIZE];
|
||||
const wchar_t *p;
|
||||
const wchar_t *q;
|
||||
|
||||
_DIAGASSERT(s != NULL);
|
||||
_DIAGASSERT(set != NULL);
|
||||
|
||||
p = s;
|
||||
while (*p) {
|
||||
if (set[0] == '\0')
|
||||
return NULL;
|
||||
if (set[1] == '\0')
|
||||
return wcschr(s, set[0]);
|
||||
|
||||
wcsspn_bloom_init(bloom, set);
|
||||
|
||||
for (p = s; *p; ++p) {
|
||||
if (!wcsspn_in_bloom(bloom, *p))
|
||||
continue;
|
||||
|
||||
q = set;
|
||||
while (*q) {
|
||||
do {
|
||||
if (*p == *q)
|
||||
return __UNCONST(p);
|
||||
q++;
|
||||
}
|
||||
p++;
|
||||
} while (*++q);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcsrchr.c,v 1.3 2005/11/29 03:12:00 christos Exp $ */
|
||||
/* $NetBSD: wcsrchr.c,v 1.4 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,16 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcsrchr.c,v 1.3 2005/11/29 03:12:00 christos Exp $");
|
||||
__RCSID("$NetBSD: wcsrchr.c,v 1.4 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wcsrchr(s, c)
|
||||
const wchar_t *s;
|
||||
wchar_t c;
|
||||
wcsrchr(const wchar_t *s, wchar_t c)
|
||||
{
|
||||
const wchar_t *p;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcsstr.c,v 1.4 2005/11/29 03:12:00 christos Exp $ */
|
||||
/* $NetBSD: wcsstr.c,v 1.5 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcsstr.c,v 1.4 2005/11/29 03:12:00 christos Exp $");
|
||||
__RCSID("$NetBSD: wcsstr.c,v 1.5 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
@@ -38,12 +38,10 @@ __RCSID("$NetBSD: wcsstr.c,v 1.4 2005/11/29 03:12:00 christos Exp $");
|
||||
|
||||
wchar_t *
|
||||
#ifdef WCSWCS
|
||||
wcswcs(big, little)
|
||||
wcswcs(const wchar_t *big, const wchar_t *little)
|
||||
#else
|
||||
wcsstr(big, little)
|
||||
wcsstr(const wchar_t *big, const wchar_t *little)
|
||||
#endif
|
||||
const wchar_t *big;
|
||||
const wchar_t *little;
|
||||
{
|
||||
const wchar_t *p;
|
||||
const wchar_t *q;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wcstok.c,v 1.3 2003/07/10 08:50:48 tshiozak Exp $ */
|
||||
/* $NetBSD: wcstok.c,v 1.4 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 Softweyr LLC. All rights reserved.
|
||||
@@ -43,17 +43,15 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wcstok.c,v 1.3 2003/07/10 08:50:48 tshiozak Exp $");
|
||||
__RCSID("$NetBSD: wcstok.c,v 1.4 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wcstok(s, delim, last)
|
||||
wchar_t * __restrict s;
|
||||
const wchar_t * __restrict delim;
|
||||
wchar_t ** __restrict last;
|
||||
wcstok(wchar_t * __restrict s, const wchar_t * __restrict delim,
|
||||
wchar_t ** __restrict last)
|
||||
{
|
||||
const wchar_t *spanp;
|
||||
wchar_t c, sc;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wmemchr.c,v 1.3 2005/11/29 03:12:00 christos Exp $ */
|
||||
/* $NetBSD: wmemchr.c,v 1.4 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,17 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wmemchr.c,v 1.3 2005/11/29 03:12:00 christos Exp $");
|
||||
__RCSID("$NetBSD: wmemchr.c,v 1.4 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wmemchr(s, c, n)
|
||||
const wchar_t *s;
|
||||
wchar_t c;
|
||||
size_t n;
|
||||
wmemchr(const wchar_t *s, wchar_t c, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wmemcmp.c,v 1.6 2009/01/11 02:46:30 christos Exp $ */
|
||||
/* $NetBSD: wmemcmp.c,v 1.7 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wmemcmp.c,v 1.6 2009/01/11 02:46:30 christos Exp $");
|
||||
__RCSID("$NetBSD: wmemcmp.c,v 1.7 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
@@ -38,10 +38,7 @@ __RCSID("$NetBSD: wmemcmp.c,v 1.6 2009/01/11 02:46:30 christos Exp $");
|
||||
#include "runetype_local.h"
|
||||
|
||||
int
|
||||
wmemcmp(s1, s2, n)
|
||||
const wchar_t *s1;
|
||||
const wchar_t *s2;
|
||||
size_t n;
|
||||
wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wmemcpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */
|
||||
/* $NetBSD: wmemcpy.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wmemcpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $");
|
||||
__RCSID("$NetBSD: wmemcpy.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
@@ -38,10 +38,7 @@ __RCSID("$NetBSD: wmemcpy.c,v 1.2 2001/01/03 14:29:37 lukem Exp $");
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wmemcpy(d, s, n)
|
||||
wchar_t *d;
|
||||
const wchar_t *s;
|
||||
size_t n;
|
||||
wmemcpy(wchar_t *d, const wchar_t *s, size_t n)
|
||||
{
|
||||
|
||||
_DIAGASSERT(d != NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wmemmove.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */
|
||||
/* $NetBSD: wmemmove.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wmemmove.c,v 1.2 2001/01/03 14:29:37 lukem Exp $");
|
||||
__RCSID("$NetBSD: wmemmove.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
@@ -38,10 +38,7 @@ __RCSID("$NetBSD: wmemmove.c,v 1.2 2001/01/03 14:29:37 lukem Exp $");
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wmemmove(d, s, n)
|
||||
wchar_t *d;
|
||||
const wchar_t *s;
|
||||
size_t n;
|
||||
wmemmove(wchar_t *d, const wchar_t *s, size_t n)
|
||||
{
|
||||
|
||||
_DIAGASSERT(d != NULL);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: wmemset.c,v 1.2 2001/01/03 14:29:37 lukem Exp $ */
|
||||
/* $NetBSD: wmemset.c,v 1.3 2012/06/25 22:32:46 abs Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
@@ -30,17 +30,14 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
__RCSID("$NetBSD: wmemset.c,v 1.2 2001/01/03 14:29:37 lukem Exp $");
|
||||
__RCSID("$NetBSD: wmemset.c,v 1.3 2012/06/25 22:32:46 abs Exp $");
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
#include <assert.h>
|
||||
#include <wchar.h>
|
||||
|
||||
wchar_t *
|
||||
wmemset(s, c, n)
|
||||
wchar_t *s;
|
||||
wchar_t c;
|
||||
size_t n;
|
||||
wmemset(wchar_t *s, wchar_t c, size_t n)
|
||||
{
|
||||
size_t i;
|
||||
wchar_t *p;
|
||||
|
||||
Reference in New Issue
Block a user