index() shouldn't be used in the kernel. Use strchr() instead.
This commit is contained in:
parent
075b65698a
commit
592280de7a
@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: index.S,v 1.2 1999/08/23 09:07:35 kleink Exp $")
|
||||
#endif
|
||||
|
||||
#ifdef STRCHR
|
||||
ENTRY(strchr)
|
||||
#else
|
||||
ENTRY(index)
|
||||
#endif
|
||||
pushl %ebx
|
||||
movl 8(%esp),%eax
|
||||
movb 12(%esp),%cl
|
||||
_ALIGN_TEXT,0x90
|
||||
L1:
|
||||
movb (%eax),%bl
|
||||
cmpb %bl,%cl /* found char??? */
|
||||
je L2
|
||||
incl %eax
|
||||
testb %bl,%bl /* null terminator??? */
|
||||
jnz L1
|
||||
xorl %eax,%eax
|
||||
L2:
|
||||
popl %ebx
|
||||
ret
|
@ -1,4 +1,31 @@
|
||||
/* $NetBSD: strchr.S,v 1.1 1998/02/22 07:01:44 mycroft Exp $ */
|
||||
/*
|
||||
* Written by J.T. Conklin <jtc@netbsd.org>.
|
||||
* Public domain.
|
||||
*/
|
||||
|
||||
#define STRCHR
|
||||
#include "index.S"
|
||||
#include <machine/asm.h>
|
||||
|
||||
#if defined(LIBC_SCCS)
|
||||
RCSID("$NetBSD: strchr.S,v 1.2 2003/10/27 07:28:15 junyoung Exp $")
|
||||
#endif
|
||||
|
||||
#ifdef INDEX
|
||||
ENTRY(index)
|
||||
#else
|
||||
ENTRY(strchr)
|
||||
#endif
|
||||
pushl %ebx
|
||||
movl 8(%esp),%eax
|
||||
movb 12(%esp),%cl
|
||||
_ALIGN_TEXT,0x90
|
||||
L1:
|
||||
movb (%eax),%bl
|
||||
cmpb %bl,%cl /* found char??? */
|
||||
je L2
|
||||
incl %eax
|
||||
testb %bl,%bl /* null terminator??? */
|
||||
jnz L1
|
||||
xorl %eax,%eax
|
||||
L2:
|
||||
popl %ebx
|
||||
ret
|
||||
|
Loading…
Reference in New Issue
Block a user