part of the ISO C standard and have also been dropped from POSIX.
OK guenther@ kettenis@
-# $OpenBSD: Makefile.inc,v 1.8 2014/11/30 19:43:54 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.9 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.S memcpy.c memmove.S \
- index.c rindex.c strchr.c strrchr.c \
+ strchr.c strrchr.c \
bzero.S ffs.S \
memchr.c memcmp.c memset.c strcat.c bcmp.c \
strcmp.c strcpy.c strcspn.c strlen.c strlcat.c strlcpy.c \
-/* $OpenBSD: strchr.S,v 1.4 2014/12/09 15:10:39 reyk Exp $ */
+/* $OpenBSD: strchr.S,v 1.5 2015/05/15 22:29:37 millert Exp $ */
/* $NetBSD: strchr.S,v 1.7 2014/03/22 19:16:34 jakllsch Exp $ */
/*-
#include <machine/asm.h>
-STRONG_ALIAS(index, strchr)
+WEAK_ALIAS(index, strchr)
/*
* On entry %rdi is the buffer and the low byte of %rsi (%sil) the
-/* $OpenBSD: strrchr.S,v 1.4 2014/12/09 15:10:39 reyk Exp $ */
+/* $OpenBSD: strrchr.S,v 1.5 2015/05/15 22:29:37 millert Exp $ */
/* $NetBSD: strrchr.S,v 1.3 2014/03/22 19:16:34 jakllsch Exp $ */
/*
#include <machine/asm.h>
-STRONG_ALIAS(rindex, strrchr)
+WEAK_ALIAS(rindex, strrchr)
ENTRY(strrchr)
movzbq %sil,%rcx
-# $OpenBSD: Makefile.inc,v 1.7 2014/11/30 19:43:56 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.8 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.S memcpy.c memmove.S _memcpy.S \
- index.c rindex.c strchr.c strrchr.c \
+ strchr.c strrchr.c \
bcmp.c bzero.S ffs.S memchr.c memcmp.S memset.S \
strcmp.S strncmp.S \
strcat.c strcpy.c strcspn.c strlen.c strlcat.c strlcpy.c \
-# $OpenBSD: Makefile.inc,v 1.9 2014/12/05 01:30:44 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.10 2015/05/15 22:29:37 millert Exp $
SRCS+= memmove.S memcpy.c \
- index.c rindex.c strchr.c strrchr.c \
+ strchr.c strrchr.c \
bcmp.c bzero.c ffs.c memchr.c memcmp.c \
memset.c strcat.c strcmp.c strcpy.c strcspn.c strlen.c \
strlcat.c strlcpy.c strncat.c strncmp.c strncpy.c \
-# $OpenBSD: Makefile.inc,v 1.3 2014/11/30 19:43:56 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.4 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.c memcpy.c memmove.c \
- index.c rindex.c strchr.c strrchr.c \
+ strchr.c strrchr.c \
bcmp.c bzero.c ffs.c memchr.c memcmp.c \
memset.c strcat.c strcmp.c strcpy.c strcspn.c strlen.c \
strlcat.c strlcpy.c strncat.c strncmp.c strncpy.c \
-/* $OpenBSD: strchr.S,v 1.5 2015/05/14 21:40:37 kettenis Exp $ */
+/* $OpenBSD: strchr.S,v 1.6 2015/05/15 22:29:37 millert Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
#include <machine/asm.h>
-STRONG_ALIAS(index, strchr)
+WEAK_ALIAS(index, strchr)
ENTRY(strchr)
movl 4(%esp),%eax
-/* $OpenBSD: strrchr.S,v 1.5 2015/05/14 21:40:37 kettenis Exp $ */
+/* $OpenBSD: strrchr.S,v 1.6 2015/05/15 22:29:37 millert Exp $ */
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
#include <machine/asm.h>
-STRONG_ALIAS(rindex, strrchr)
+WEAK_ALIAS(rindex, strrchr)
ENTRY(strrchr)
pushl %ebx
-# $OpenBSD: Makefile.inc,v 1.6 2014/11/30 19:43:56 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.7 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.c memcpy.c memmove.c \
- index.c rindex.c strchr.c strrchr.c \
+ strchr.c strrchr.c \
bcmp.c bzero.c ffs.c memchr.c memcmp.c \
memset.c strcat.c strcmp.c strcpy.c strcspn.c \
strlen.c strlcat.c strlcpy.c strncat.c strncmp.c \
-/* $OpenBSD: strchr.S,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */
+/* $OpenBSD: strchr.S,v 1.2 2015/05/15 22:29:37 millert Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
#include <machine/asm.h>
+WEAK_ALIAS(index, strchr)
+
LEAF(strchr, 0)
-ALEAF(index)
.set reorder
0:
lbu a2, 0(a0) # get a byte
-/* $OpenBSD: strrchr.S,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */
+/* $OpenBSD: strrchr.S,v 1.2 2015/05/15 22:29:37 millert Exp $ */
/*-
* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
#include <machine/asm.h>
+WEAK_ALIAS(rindex, strrchr)
+
LEAF(strrchr, 0)
-ALEAF(rindex)
.set reorder
move v0, zero # default if not found
1:
-# $OpenBSD: Makefile.inc,v 1.5 2014/12/04 12:10:26 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.6 2015/05/15 22:29:37 millert Exp $
SRCS+= memcpy.c memmove.S \
- index.c rindex.c strchr.c strrchr.c \
+ strchr.c strrchr.c \
bcmp.c bzero.c ffs.c memchr.c memcmp.c memset.c strcat.c \
strcmp.c strcpy.c strcspn.c strlen.c strlcat.c strlcpy.c \
strncat.c strncmp.c strncpy.c strpbrk.c strsep.c \
-# $OpenBSD: Makefile.inc,v 1.4 2014/11/30 19:43:56 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.S memcpy.c memmove.S \
bzero.S ffs.S memset.S \
- index.c rindex.c strchr.c strrchr.c \
+ strchr.c strrchr.c \
bcmp.c memcmp.c memchr.c strcat.c strcmp.c strcpy.c strcspn.c \
strlen.c strlcat.c strlcpy.c strncat.c strncmp.c strncpy.c \
strpbrk.c strsep.c strspn.c strstr.c swab.c
-# $OpenBSD: Makefile.inc,v 1.6 2014/11/30 19:43:56 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.7 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.c memcpy.c memmove.c \
ffs.S strlen.S bzero.S \
- bcmp.c index.c memchr.c memcmp.c \
- memset.c rindex.c strcat.c strchr.c \
+ bcmp.c memchr.c memcmp.c \
+ memset.c strcat.c strchr.c \
strcmp.c strcpy.c strcspn.c strlcat.c strlcpy.c \
strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
strspn.c strstr.c swab.c
-# $OpenBSD: Makefile.inc,v 1.4 2014/11/30 19:43:56 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.5 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.c memcpy.c memmove.c \
ffs.S \
strlen.S \
- bcmp.c bzero.c index.c memchr.c memcmp.c \
- memset.c rindex.c strcat.c strchr.c \
+ bcmp.c bzero.c memchr.c memcmp.c \
+ memset.c strcat.c strchr.c \
strcmp.c strcpy.c strcspn.c strlcat.c strlcpy.c \
strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strsep.c \
strspn.c strstr.c swab.c
-# $OpenBSD: Makefile.inc,v 1.9 2014/11/30 19:43:56 deraadt Exp $
+# $OpenBSD: Makefile.inc,v 1.10 2015/05/15 22:29:37 millert Exp $
SRCS+= bcopy.S memcpy.c memmove.S \
bcmp.S bzero.S ffs.S memchr.c memcmp.S \
memset.S \
- strchr.S rindex.c strrchr.c \
+ strchr.S strrchr.c \
strcat.c strcmp.c strcpy.c strcspn.c strlen.c strlcat.c \
strlcpy.c strncat.c strncmp.c strncpy.c strpbrk.c \
strsep.c strspn.c strstr.c swab.c
-/* $OpenBSD: strchr.S,v 1.1 2014/11/30 19:43:56 deraadt Exp $ */
+/* $OpenBSD: strchr.S,v 1.2 2015/05/15 22:29:37 millert Exp $ */
/*
* Copyright (c) 1980, 1993
* The Regents of the University of California. All rights reserved.
/* Alas not quite twice as fast as the generic C version on a uvax2 */
-STRONG_ALIAS(index, strchr)
+WEAK_ALIAS(index, strchr)
ENTRY(strchr, 0)
movq 4(%ap),%r0 # r0 = cp; r1 = c
tstb %r1 # special case, looking for '\0'
+++ /dev/null
-/* $OpenBSD: index.c,v 1.6 2014/11/30 19:43:56 deraadt Exp $ */
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <string.h>
-
-char *
-index(const char *p, int ch)
-{
- for (;; ++p) {
- if (*p == ch)
- return((char *)p);
- if (!*p)
- return((char *)NULL);
- }
- /* NOTREACHED */
-}
+++ /dev/null
-/* $OpenBSD: rindex.c,v 1.7 2014/11/30 19:43:56 deraadt Exp $ */
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * 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.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#include <string.h>
-
-char *
-rindex(const char *p, int ch)
-{
- char *save;
-
- for (save = NULL;; ++p) {
- if (*p == ch)
- save = (char *)p;
- if (!*p)
- return(save);
- }
- /* NOTREACHED */
-}
-/* $OpenBSD: strchr.c,v 1.1 2014/11/30 19:43:57 deraadt Exp $ */
+/* $OpenBSD: strchr.c,v 1.2 2015/05/15 22:29:37 millert Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
#include <string.h>
+__weak_alias(index, strchr);
+
char *
strchr(const char *p, int ch)
{
-/* $OpenBSD: strrchr.c,v 1.1 2014/11/30 19:43:57 deraadt Exp $ */
+/* $OpenBSD: strrchr.c,v 1.2 2015/05/15 22:29:37 millert Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
#include <string.h>
+__weak_alias(rindex, strrchr);
+
char *
strrchr(const char *p, int ch)
{