Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcvs2svn <>2008-09-05 00:26:21 +0400
committercvs2svn <>2008-09-05 00:26:21 +0400
commit07b4b67a88f386ce4716a14e0ff2c2bce992b985 (patch)
tree2d367e3f5c271ef2cdf093f175039cd701237bc7 /newlib/libc/string
parentcfef0dc52cc4eab69ddeab566fa31790a2328b6a (diff)
This commit was manufactured by cvs2svn to create tag 'newlib-1_16_0'.newlib-1_16_0
Sprout from binutils-arc-20080908-branch 2008-09-04 20:26:19 UTC cvs2svn 'This commit was manufactured by cvs2svn to create branch 'binutils-' Cherrypick from master 2007-12-19 22:36:48 UTC Jeff Johnston <jjohnstn@redhat.com> '': ChangeLog MAINTAINERS Makefile.def Makefile.in Makefile.tpl config.guess config.rpath config.sub config/ChangeLog config/acinclude.m4 config/acx.m4 config/confsubdir.m4 config/mh-i370pic config/mh-ia64pic config/mh-mingw config/mh-ppc-darwin config/mh-s390pic config/mh-sparcpic config/mt-mips-elfoabi config/mt-spu config/tls.m4 configure configure.ac libgloss/ChangeLog libgloss/arm/configure libgloss/arm/crt0.S libgloss/arm/redboot-syscalls.c libgloss/bfin/Makefile.in libgloss/bfin/configure libgloss/bfin/syscalls.c libgloss/configure libgloss/cris/configure libgloss/cris/gensyscalls libgloss/crx/configure libgloss/d30v/configure libgloss/doc/configure libgloss/fr30/configure libgloss/fr30/syscalls.c libgloss/frv/configure libgloss/frv/crt0.S libgloss/frv/isatty.c libgloss/hp74x/configure libgloss/i386/configure libgloss/i960/configure libgloss/iq2000/configure libgloss/iq2000/crt0.S libgloss/iq2000/isatty.c libgloss/libnosys/configure libgloss/libnosys/configure.in libgloss/libnosys/isatty.c libgloss/m32c/configure libgloss/m32c/exit.S libgloss/m32r/configure libgloss/m32r/isatty.c libgloss/m68hc11/configure libgloss/m68k/cf-crt1.c libgloss/m68k/configure libgloss/mcore/configure libgloss/mep/configure libgloss/mips/configure libgloss/mn10200/configure libgloss/mn10200/isatty.c libgloss/mn10300/configure libgloss/mn10300/crt0.S libgloss/mn10300/isatty.c libgloss/mt/configure libgloss/pa/configure libgloss/rs6000/configure libgloss/sparc/configure libgloss/sparc/libsys/configure libgloss/spu/Makefile.in libgloss/spu/configure libgloss/spu/readlink.c libgloss/spu/sbrk.c libgloss/spu/syscalls.c libgloss/wince/configure libgloss/xstormy16/configure libtool.m4 ltsugar.m4 newlib/ChangeLog newlib/Makefile.am newlib/Makefile.in newlib/configure.host newlib/libc/argz/argz_count.c newlib/libc/argz/argz_extract.c newlib/libc/argz/argz_stringify.c newlib/libc/ctype/ctype_.c newlib/libc/ctype/isalnum.c newlib/libc/ctype/isalpha.c newlib/libc/ctype/iscntrl.c newlib/libc/ctype/isdigit.c newlib/libc/ctype/islower.c newlib/libc/ctype/isprint.c newlib/libc/ctype/ispunct.c newlib/libc/ctype/isspace.c newlib/libc/ctype/isupper.c newlib/libc/ctype/isxdigit.c newlib/libc/include/_ansi.h newlib/libc/include/_syslist.h newlib/libc/include/assert.h newlib/libc/include/ctype.h newlib/libc/include/getopt.h newlib/libc/include/machine/_default_types.h newlib/libc/include/machine/ieeefp.h newlib/libc/include/machine/setjmp.h newlib/libc/include/math.h newlib/libc/include/reent.h newlib/libc/include/stdint.h newlib/libc/include/stdio.h newlib/libc/include/string.h newlib/libc/include/sys/_default_fcntl.h newlib/libc/include/sys/reent.h newlib/libc/include/sys/stat.h newlib/libc/include/sys/unistd.h newlib/libc/libc.texinfo newlib/libc/machine/arm/setjmp.S newlib/libc/machine/configure newlib/libc/machine/i386/memchr.S newlib/libc/machine/i386/memset.S newlib/libc/machine/i386/strchr.S newlib/libc/machine/i386/strlen.S newlib/libc/machine/m68k/memcpy.S newlib/libc/machine/m68k/memset.S newlib/libc/machine/m68k/setjmp.S newlib/libc/machine/mips/strncpy.c newlib/libc/machine/mn10300/memset.S newlib/libc/machine/powerpc/vfprintf.c newlib/libc/machine/spu/Makefile.am newlib/libc/machine/spu/Makefile.in newlib/libc/machine/spu/fprintf.S newlib/libc/machine/spu/fscanf.S newlib/libc/machine/spu/mk_syscalls newlib/libc/machine/spu/printf.S newlib/libc/machine/spu/scanf.S newlib/libc/machine/spu/setjmp.S newlib/libc/machine/spu/snprintf.S newlib/libc/machine/spu/sprintf.S newlib/libc/machine/spu/sscanf.S newlib/libc/machine/spu/stack_reg_va.S newlib/libc/machine/spu/strcat.c newlib/libc/machine/spu/strcpy.c newlib/libc/machine/spu/strlen.c newlib/libc/machine/spu/strncat.c newlib/libc/machine/spu/strncmp.c newlib/libc/machine/spu/strncpy.c newlib/libc/machine/spu/sys/dirent.h newlib/libc/machine/spu/sys/errno.h newlib/libc/machine/spu/sys/sched.h newlib/libc/machine/spu/sys/syscall.h newlib/libc/posix/Makefile.am newlib/libc/posix/Makefile.in newlib/libc/posix/isatty.c newlib/libc/reent/Makefile.am newlib/libc/reent/Makefile.in newlib/libc/search/hash.h newlib/libc/stdio/Makefile.am newlib/libc/stdio/Makefile.in newlib/libc/stdio/asiprintf.c newlib/libc/stdio/asniprintf.c newlib/libc/stdio/asnprintf.c newlib/libc/stdio/asprintf.c newlib/libc/stdio/dprintf.c newlib/libc/stdio/fflush.c newlib/libc/stdio/freopen.c newlib/libc/stdio/ftell.c newlib/libc/stdio/local.h newlib/libc/stdio/makebuf.c newlib/libc/stdio/rget.c newlib/libc/stdio/siprintf.c newlib/libc/stdio/siscanf.c newlib/libc/stdio/sniprintf.c newlib/libc/stdio/snprintf.c newlib/libc/stdio/sprintf.c newlib/libc/stdio/sscanf.c newlib/libc/stdio/vasiprintf.c newlib/libc/stdio/vasniprintf.c newlib/libc/stdio/vasnprintf.c newlib/libc/stdio/vasprintf.c newlib/libc/stdio/vdiprintf.c newlib/libc/stdio/vdprintf.c newlib/libc/stdio/vfprintf.c newlib/libc/stdio/vfscanf.c newlib/libc/stdio/vsiprintf.c newlib/libc/stdio/vsiscanf.c newlib/libc/stdio/vsniprintf.c newlib/libc/stdio/vsnprintf.c newlib/libc/stdio/vsprintf.c newlib/libc/stdio/vsscanf.c newlib/libc/stdio64/ftello64.c newlib/libc/stdlib/envlock.h newlib/libc/stdlib/gdtoa-hexnan.c newlib/libc/stdlib/getopt.c newlib/libc/stdlib/mprec.h newlib/libc/stdlib/strtod.c newlib/libc/stdlib/wcsrtombs.c newlib/libc/string/Makefile.am newlib/libc/string/Makefile.in newlib/libc/string/memchr.c newlib/libc/string/memset.c newlib/libc/string/strcasestr.c newlib/libc/string/strchr.c newlib/libc/string/strings.tex newlib/libc/string/strlen.c newlib/libc/string/strstr.c newlib/libc/sys/a29khif/_isatty.S newlib/libc/sys/arc/isatty.c newlib/libc/sys/arm/syscalls.c newlib/libc/sys/configure newlib/libc/sys/d10v/syscalls.c newlib/libc/sys/h8300hms/syscalls.c newlib/libc/sys/h8500hms/syscalls.c newlib/libc/sys/linux/Makefile.am newlib/libc/sys/linux/Makefile.in newlib/libc/sys/linux/bits/libc-lock.h newlib/libc/sys/linux/iconv/iconvconfig.c newlib/libc/sys/linux/iconv/strtab.c newlib/libc/sys/linux/include/arpa/nameser.h newlib/libc/sys/linux/include/hesiod.h newlib/libc/sys/linux/include/libc_private.h newlib/libc/sys/linux/include/net/ethernet.h newlib/libc/sys/linux/include/net/if_atm.h newlib/libc/sys/linux/include/net/if_media.h newlib/libc/sys/linux/include/net/if_ppp.h newlib/libc/sys/linux/include/net/if_pppvar.h newlib/libc/sys/linux/include/netdb.h newlib/libc/sys/linux/include/netinet/if_atm.h newlib/libc/sys/linux/include/netinet/if_ether.h newlib/libc/sys/linux/include/netinet/ip_flow.h newlib/libc/sys/linux/include/nsswitch.h newlib/libc/sys/linux/include/resolv.h newlib/libc/sys/linux/include/sched.h newlib/libc/sys/linux/include/stdint.h newlib/libc/sys/linux/intl/locale.alias newlib/libc/sys/linux/libc-symbols.h newlib/libc/sys/linux/machine/i386/get_clockfreq.c newlib/libc/sys/linux/machine/i386/include/endian.h newlib/libc/sys/linux/machine/i386/include/param.h newlib/libc/sys/linux/net/Makefile.am newlib/libc/sys/linux/net/Makefile.in newlib/libc/sys/linux/net/addr2ascii.3 newlib/libc/sys/linux/net/base64.c newlib/libc/sys/linux/net/bindresvport.c newlib/libc/sys/linux/net/byteorder.3 newlib/libc/sys/linux/net/ether_addr.c newlib/libc/sys/linux/net/ethers.3 newlib/libc/sys/linux/net/getaddrinfo.3 newlib/libc/sys/linux/net/getaddrinfo.c newlib/libc/sys/linux/net/gethostbydns.c newlib/libc/sys/linux/net/gethostbyht.c newlib/libc/sys/linux/net/gethostbyname.3 newlib/libc/sys/linux/net/gethostbynis.c newlib/libc/sys/linux/net/gethostnamadr.c newlib/libc/sys/linux/net/getifaddrs.3 newlib/libc/sys/linux/net/getifaddrs.c newlib/libc/sys/linux/net/getipnodebyname.3 newlib/libc/sys/linux/net/getnameinfo.3 newlib/libc/sys/linux/net/getnameinfo.c newlib/libc/sys/linux/net/getnetbydns.c newlib/libc/sys/linux/net/getnetbyht.c newlib/libc/sys/linux/net/getnetbynis.c newlib/libc/sys/linux/net/getnetent.3 newlib/libc/sys/linux/net/getnetnamadr.c newlib/libc/sys/linux/net/getproto.c newlib/libc/sys/linux/net/getprotoent.3 newlib/libc/sys/linux/net/getprotoent.c newlib/libc/sys/linux/net/getprotoname.c newlib/libc/sys/linux/net/getservbyname.c newlib/libc/sys/linux/net/getservbyport.c newlib/libc/sys/linux/net/getservent.3 newlib/libc/sys/linux/net/getservent.c newlib/libc/sys/linux/net/herror.c newlib/libc/sys/linux/net/hesiod.3 newlib/libc/sys/linux/net/hesiod.c newlib/libc/sys/linux/net/if_indextoname.3 newlib/libc/sys/linux/net/inet.3 newlib/libc/sys/linux/net/inet6_option_space.3 newlib/libc/sys/linux/net/inet6_rthdr_space.3 newlib/libc/sys/linux/net/inet_lnaof.c newlib/libc/sys/linux/net/inet_makeaddr.c newlib/libc/sys/linux/net/inet_net.3 newlib/libc/sys/linux/net/inet_netof.c newlib/libc/sys/linux/net/inet_network.c newlib/libc/sys/linux/net/inet_ntoa.c newlib/libc/sys/linux/net/innetgr-stub.c newlib/libc/sys/linux/net/ip6opt.c newlib/libc/sys/linux/net/iso_addr.3 newlib/libc/sys/linux/net/iso_addr.c newlib/libc/sys/linux/net/linkaddr.3 newlib/libc/sys/linux/net/linkaddr.c newlib/libc/sys/linux/net/map_v4v6.c newlib/libc/sys/linux/net/name6.c newlib/libc/sys/linux/net/namespace.h newlib/libc/sys/linux/net/ns.3 newlib/libc/sys/linux/net/ns_addr.c newlib/libc/sys/linux/net/ns_name.c newlib/libc/sys/linux/net/ns_netint.c newlib/libc/sys/linux/net/ns_ntoa.c newlib/libc/sys/linux/net/ns_parse.c newlib/libc/sys/linux/net/ns_print.c newlib/libc/sys/linux/net/ns_ttl.c newlib/libc/sys/linux/net/nsap_addr.c newlib/libc/sys/linux/net/nsdispatch.3 newlib/libc/sys/linux/net/nsdispatch.c newlib/libc/sys/linux/net/nslexer.c newlib/libc/sys/linux/net/nslexer.l newlib/libc/sys/linux/net/nsparser.c newlib/libc/sys/linux/net/nsparser.h newlib/libc/sys/linux/net/nsparser.y newlib/libc/sys/linux/net/rcmd.3 newlib/libc/sys/linux/net/rcmd.c newlib/libc/sys/linux/net/rcmdsh.3 newlib/libc/sys/linux/net/res_comp.c newlib/libc/sys/linux/net/res_config.h newlib/libc/sys/linux/net/res_data.c newlib/libc/sys/linux/net/res_debug.c newlib/libc/sys/linux/net/res_init.c newlib/libc/sys/linux/net/res_mkquery.c newlib/libc/sys/linux/net/res_mkupdate.c newlib/libc/sys/linux/net/res_query.c newlib/libc/sys/linux/net/res_send.c newlib/libc/sys/linux/net/res_update.c newlib/libc/sys/linux/net/resolver.3 newlib/libc/sys/linux/net/rthdr.c newlib/libc/sys/linux/net/send.c newlib/libc/sys/linux/net/vars.c newlib/libc/sys/linux/stdlib/COPYRIGHT newlib/libc/sys/linux/stdlib/Makefile.am newlib/libc/sys/linux/stdlib/Makefile.in newlib/libc/sys/linux/stdlib/cclass.h newlib/libc/sys/linux/stdlib/cname.h newlib/libc/sys/linux/stdlib/collate.c newlib/libc/sys/linux/stdlib/collate.h newlib/libc/sys/linux/stdlib/collcmp.c newlib/libc/sys/linux/stdlib/engine.c newlib/libc/sys/linux/stdlib/fnmatch.3 newlib/libc/sys/linux/stdlib/fnmatch.c newlib/libc/sys/linux/stdlib/glob.3 newlib/libc/sys/linux/stdlib/glob.c newlib/libc/sys/linux/stdlib/reallocf.c newlib/libc/sys/linux/stdlib/regcomp.c newlib/libc/sys/linux/stdlib/regerror.c newlib/libc/sys/linux/stdlib/regex.3 newlib/libc/sys/linux/stdlib/regex2.h newlib/libc/sys/linux/stdlib/regexec.c newlib/libc/sys/linux/stdlib/regfree.c newlib/libc/sys/linux/stdlib/utils.h newlib/libc/sys/linux/stdlib/wordexp.c newlib/libc/sys/linux/stdlib/wordfree.c newlib/libc/sys/linux/sys/ioctl.h newlib/libc/sys/linux/sys/socket.h newlib/libc/sys/linux/sys/types.h newlib/libc/sys/linux/sys/unistd.h newlib/libc/sys/mmixware/isatty.c newlib/libc/sys/sh/syscalls.c newlib/libc/sys/sysnecv850/crt0.S newlib/libc/sys/sysnecv850/isatty.c newlib/libc/syscalls/Makefile.am newlib/libc/syscalls/Makefile.in newlib/libc/syscalls/sysclose.c newlib/libc/syscalls/sysexecve.c newlib/libc/syscalls/sysfcntl.c newlib/libc/syscalls/sysfork.c newlib/libc/syscalls/sysfstat.c newlib/libc/syscalls/sysgetpid.c newlib/libc/syscalls/sysgettod.c newlib/libc/syscalls/syskill.c newlib/libc/syscalls/syslink.c newlib/libc/syscalls/syslseek.c newlib/libc/syscalls/sysopen.c newlib/libc/syscalls/sysread.c newlib/libc/syscalls/syssbrk.c newlib/libc/syscalls/sysstat.c newlib/libc/syscalls/systimes.c newlib/libc/syscalls/sysunlink.c newlib/libc/syscalls/syswait.c newlib/libc/syscalls/syswrite.c newlib/libc/time/mktime.c newlib/libm/libm.texinfo newlib/libm/machine/spu/configure newlib/libm/machine/spu/headers/acosd2.h newlib/libm/machine/spu/headers/acosf4.h newlib/libm/machine/spu/headers/acoshd2.h newlib/libm/machine/spu/headers/acoshf4.h newlib/libm/machine/spu/headers/asind2.h newlib/libm/machine/spu/headers/asinf4.h newlib/libm/machine/spu/headers/asinhd2.h newlib/libm/machine/spu/headers/asinhf4.h newlib/libm/machine/spu/headers/atan2d2.h newlib/libm/machine/spu/headers/atan2f4.h newlib/libm/machine/spu/headers/atand2.h newlib/libm/machine/spu/headers/atanf4.h newlib/libm/machine/spu/headers/atanhd2.h newlib/libm/machine/spu/headers/atanhf4.h newlib/libm/machine/spu/headers/cbrt.h newlib/libm/machine/spu/headers/cbrtf.h newlib/libm/machine/spu/headers/cos_sin.h newlib/libm/machine/spu/headers/cosd2.h newlib/libm/machine/spu/headers/cosf4.h newlib/libm/machine/spu/headers/coshd2.h newlib/libm/machine/spu/headers/coshf4.h newlib/libm/machine/spu/headers/divd2.h newlib/libm/machine/spu/headers/divf4.h newlib/libm/machine/spu/headers/erf_utils.h newlib/libm/machine/spu/headers/erfcd2.h newlib/libm/machine/spu/headers/erfcf4.h newlib/libm/machine/spu/headers/erfd2.h newlib/libm/machine/spu/headers/erff4.h newlib/libm/machine/spu/headers/exp2d2.h newlib/libm/machine/spu/headers/exp2f4.h newlib/libm/machine/spu/headers/expd2.h newlib/libm/machine/spu/headers/expf4.h newlib/libm/machine/spu/headers/expm1d2.h newlib/libm/machine/spu/headers/expm1f4.h newlib/libm/machine/spu/headers/floord2.h newlib/libm/machine/spu/headers/floorf4.h newlib/libm/machine/spu/headers/hypotd2.h newlib/libm/machine/spu/headers/hypotf4.h newlib/libm/machine/spu/headers/isnand2.h newlib/libm/machine/spu/headers/isnanf4.h newlib/libm/machine/spu/headers/ldexpd2.h newlib/libm/machine/spu/headers/ldexpf4.h newlib/libm/machine/spu/headers/lgammad2.h newlib/libm/machine/spu/headers/lgammaf4.h newlib/libm/machine/spu/headers/log10d2.h newlib/libm/machine/spu/headers/log1pd2.h newlib/libm/machine/spu/headers/log1pf4.h newlib/libm/machine/spu/headers/log2d2.h newlib/libm/machine/spu/headers/log2f4.h newlib/libm/machine/spu/headers/logbf4.h newlib/libm/machine/spu/headers/logd2.h newlib/libm/machine/spu/headers/logf4.h newlib/libm/machine/spu/headers/nearbyintf4.h newlib/libm/machine/spu/headers/nextafterd2.h newlib/libm/machine/spu/headers/nextafterf4.h newlib/libm/machine/spu/headers/powd2.h newlib/libm/machine/spu/headers/powf4.h newlib/libm/machine/spu/headers/recipd2.h newlib/libm/machine/spu/headers/recipf4.h newlib/libm/machine/spu/headers/rintf4.h newlib/libm/machine/spu/headers/scalbnf4.h newlib/libm/machine/spu/headers/signbitd2.h newlib/libm/machine/spu/headers/simdmath.h newlib/libm/machine/spu/headers/sincosd2.h newlib/libm/machine/spu/headers/sincosf4.h newlib/libm/machine/spu/headers/sind2.h newlib/libm/machine/spu/headers/sinf4.h newlib/libm/machine/spu/headers/sinhd2.h newlib/libm/machine/spu/headers/sinhf4.h newlib/libm/machine/spu/headers/sqrtd2.h newlib/libm/machine/spu/headers/sqrtf4.h newlib/libm/machine/spu/headers/tand2.h newlib/libm/machine/spu/headers/tanf4.h newlib/libm/machine/spu/headers/tanhd2.h newlib/libm/machine/spu/headers/tanhf4.h newlib/libm/machine/spu/headers/tgammad2.h newlib/libm/machine/spu/headers/tgammaf4.h newlib/libm/machine/spu/headers/truncd2.h newlib/libm/machine/spu/headers/truncf4.h src-release Cherrypick from cygnus 1999-05-03 07:29:06 UTC Richard Henderson <rth@redhat.com> '19990502 sourceware import': config/mh-armpic config/mh-elfalphapic config/mh-m68kpic config/mh-papic config/mh-ppcpic config/mh-x86pic Delete: config/extensions.m4 config/futex.m4 config/mh-pa config/mh-pa-hpux10 config/mt-mips-gnu config/mt-mips16-compat config/override.m4 config/proginstall.m4 config/tcl.m4 libgloss/bfin/basiccrt.S libgloss/bfin/bf522.ld libgloss/bfin/bf523.ld libgloss/bfin/bf524.ld libgloss/bfin/bf525.ld libgloss/bfin/bf526.ld libgloss/bfin/bf527.ld libgloss/bfin/bf531.ld libgloss/bfin/bf532.ld libgloss/bfin/bf533.ld libgloss/bfin/bf534.ld libgloss/bfin/bf536.ld libgloss/bfin/bf537.ld libgloss/bfin/bf538.ld libgloss/bfin/bf539.ld libgloss/bfin/bf542.ld libgloss/bfin/bf544.ld libgloss/bfin/bf547.ld libgloss/bfin/bf548.ld libgloss/bfin/bf549.ld libgloss/bfin/bf561.ld libgloss/bfin/bf561a.ld libgloss/bfin/bf561b.ld libgloss/bfin/bf561m.ld libgloss/bfin/bfin-common-mc.ld libgloss/bfin/bfin-common-sc.ld libgloss/bfin/include/blackfin.h libgloss/bfin/include/cdefBF522.h libgloss/bfin/include/cdefBF525.h libgloss/bfin/include/cdefBF527.h libgloss/bfin/include/cdefBF52x_base.h libgloss/bfin/include/cdefBF531.h libgloss/bfin/include/cdefBF532.h libgloss/bfin/include/cdefBF533.h libgloss/bfin/include/cdefBF534.h libgloss/bfin/include/cdefBF535.h libgloss/bfin/include/cdefBF536.h libgloss/bfin/include/cdefBF537.h libgloss/bfin/include/cdefBF538.h libgloss/bfin/include/cdefBF539.h libgloss/bfin/include/cdefBF53x.h libgloss/bfin/include/cdefBF541.h libgloss/bfin/include/cdefBF542.h libgloss/bfin/include/cdefBF544.h libgloss/bfin/include/cdefBF547.h libgloss/bfin/include/cdefBF548.h libgloss/bfin/include/cdefBF549.h libgloss/bfin/include/cdefBF54x_base.h libgloss/bfin/include/cdefBF561.h libgloss/bfin/include/cdef_LPBlackfin.h libgloss/bfin/include/cdefblackfin.h libgloss/bfin/include/cplb.h libgloss/bfin/include/cplbtab.h libgloss/bfin/include/defBF522.h libgloss/bfin/include/defBF525.h libgloss/bfin/include/defBF527.h libgloss/bfin/include/defBF52x_base.h libgloss/bfin/include/defBF531.h libgloss/bfin/include/defBF532.h libgloss/bfin/include/defBF533.h libgloss/bfin/include/defBF534.h libgloss/bfin/include/defBF535.h libgloss/bfin/include/defBF536.h libgloss/bfin/include/defBF537.h libgloss/bfin/include/defBF538.h libgloss/bfin/include/defBF539.h libgloss/bfin/include/defBF541.h libgloss/bfin/include/defBF542.h libgloss/bfin/include/defBF544.h libgloss/bfin/include/defBF547.h libgloss/bfin/include/defBF548.h libgloss/bfin/include/defBF549.h libgloss/bfin/include/defBF54x_base.h libgloss/bfin/include/defBF561.h libgloss/bfin/include/def_LPBlackfin.h libgloss/bfin/include/defblackfin.h libgloss/bfin/include/sys/_adi_platform.h libgloss/bfin/include/sys/anomaly_macros_rtl.h libgloss/bfin/include/sys/excause.h libgloss/bfin/include/sys/exception.h libgloss/bfin/include/sys/mc_typedef.h libgloss/bfin/include/sys/platform.h libgloss/bfin/include/sys/pll.h libgloss/bfin/include/sysreg.h libgloss/spu/linux_syscalls.c libgloss/xstormy16/isatty.c newlib/libc/machine/m68k/m68kasm.h newlib/libc/machine/spu/assert.c newlib/libc/machine/spu/impure.c newlib/libc/machine/spu/include/spu_timer.h newlib/libc/machine/spu/memcmp.c newlib/libc/machine/spu/spu_clock_stop.c newlib/libc/machine/spu/spu_clock_svcs.c newlib/libc/machine/spu/spu_timebase.c newlib/libc/machine/spu/spu_timer_flih.S newlib/libc/machine/spu/spu_timer_free.c newlib/libc/machine/spu/spu_timer_internal.h newlib/libc/machine/spu/spu_timer_slih.c newlib/libc/machine/spu/spu_timer_slih_reg.c newlib/libc/machine/spu/spu_timer_stop.c newlib/libc/machine/spu/spu_timer_svcs.c newlib/libc/machine/spu/straddr.h newlib/libc/machine/spu/strcpy.h newlib/libc/machine/spu/strncmp.h newlib/libc/machine/spu/sys/linux_syscalls.h newlib/libc/posix/_isatty.c newlib/libc/reent/isattyr.c newlib/libc/string/memmem.c newlib/libc/string/str-two-way.h newlib/libc/sys/linux/isatty.c newlib/libc/sys/linux/machine/i386/atomic.h newlib/libc/sys/linux/net/XXX-lookup.c newlib/libc/sys/linux/net/alias-lookup.c newlib/libc/sys/linux/net/aliases.h newlib/libc/sys/linux/net/check_pf.c newlib/libc/sys/linux/net/databases.def newlib/libc/sys/linux/net/digits_dots.c newlib/libc/sys/linux/net/ether_aton.c newlib/libc/sys/linux/net/ether_aton_r.c newlib/libc/sys/linux/net/ether_hton.c newlib/libc/sys/linux/net/ether_line.c newlib/libc/sys/linux/net/ether_ntoa.c newlib/libc/sys/linux/net/ether_ntoa_r.c newlib/libc/sys/linux/net/ether_ntoh.c newlib/libc/sys/linux/net/etherent.h newlib/libc/sys/linux/net/ethers-lookup.c newlib/libc/sys/linux/net/function.def newlib/libc/sys/linux/net/getXXbyYY.c newlib/libc/sys/linux/net/getXXbyYY_r.c newlib/libc/sys/linux/net/getXXent.c newlib/libc/sys/linux/net/getXXent_r.c newlib/libc/sys/linux/net/getaliasent.c newlib/libc/sys/linux/net/getaliasent_r.c newlib/libc/sys/linux/net/getaliasname.c newlib/libc/sys/linux/net/getaliasname_r.c newlib/libc/sys/linux/net/gethstbyad.c newlib/libc/sys/linux/net/gethstbyad_r.c newlib/libc/sys/linux/net/gethstbynm.c newlib/libc/sys/linux/net/gethstbynm2.c newlib/libc/sys/linux/net/gethstbynm2_r.c newlib/libc/sys/linux/net/gethstbynm_r.c newlib/libc/sys/linux/net/gethstent.c newlib/libc/sys/linux/net/gethstent_r.c newlib/libc/sys/linux/net/getnetbyad.c newlib/libc/sys/linux/net/getnetbyad_r.c newlib/libc/sys/linux/net/getnetbynm.c newlib/libc/sys/linux/net/getnetbynm_r.c newlib/libc/sys/linux/net/getnetent.c newlib/libc/sys/linux/net/getnetent_r.c newlib/libc/sys/linux/net/getnetgrent.c newlib/libc/sys/linux/net/getnetgrent_r.c newlib/libc/sys/linux/net/getnssent.c newlib/libc/sys/linux/net/getnssent_r.c newlib/libc/sys/linux/net/getproto_r.c newlib/libc/sys/linux/net/getprtent.c newlib/libc/sys/linux/net/getprtent_r.c newlib/libc/sys/linux/net/getprtname.c newlib/libc/sys/linux/net/getprtname_r.c newlib/libc/sys/linux/net/getrpcbyname.c newlib/libc/sys/linux/net/getrpcbyname_r.c newlib/libc/sys/linux/net/getrpcbynumber.c newlib/libc/sys/linux/net/getrpcbynumber_r.c newlib/libc/sys/linux/net/getrpcent.c newlib/libc/sys/linux/net/getrpcent_r.c newlib/libc/sys/linux/net/getservent_r.c newlib/libc/sys/linux/net/getsrvbynm.c newlib/libc/sys/linux/net/getsrvbynm_r.c newlib/libc/sys/linux/net/getsrvbypt.c newlib/libc/sys/linux/net/getsrvbypt_r.c newlib/libc/sys/linux/net/grp-lookup.c newlib/libc/sys/linux/net/herrno.c newlib/libc/sys/linux/net/hosts-lookup.c newlib/libc/sys/linux/net/ifaddrs.h newlib/libc/sys/linux/net/ifreq.c newlib/libc/sys/linux/net/ifreq.h newlib/libc/sys/linux/net/in6_addr.c newlib/libc/sys/linux/net/inet6_option.c newlib/libc/sys/linux/net/inet_mkadr.c newlib/libc/sys/linux/net/inet_net.c newlib/libc/sys/linux/net/key-lookup.c newlib/libc/sys/linux/net/local.h newlib/libc/sys/linux/net/netgroup.h newlib/libc/sys/linux/net/netgrp-lookup.c newlib/libc/sys/linux/net/network-lookup.c newlib/libc/sys/linux/net/not-cancel.h newlib/libc/sys/linux/net/ns_samedomain.c newlib/libc/sys/linux/net/nscd-types.h newlib/libc/sys/linux/net/nscd/nscd-client.h newlib/libc/sys/linux/net/nscd/nscd_proto.h newlib/libc/sys/linux/net/nss.h newlib/libc/sys/linux/net/nsswitch.c newlib/libc/sys/linux/net/nsswitch.h newlib/libc/sys/linux/net/opensock.c newlib/libc/sys/linux/net/proto-lookup.c newlib/libc/sys/linux/net/pwd-lookup.c newlib/libc/sys/linux/net/res_debug.h newlib/libc/sys/linux/net/res_hconf.c newlib/libc/sys/linux/net/res_hconf.h newlib/libc/sys/linux/net/res_libc.c newlib/libc/sys/linux/net/rexec.c newlib/libc/sys/linux/net/rpc-lookup.c newlib/libc/sys/linux/net/ruserpass.c newlib/libc/sys/linux/net/service-lookup.c newlib/libc/sys/linux/net/spwd-lookup.c newlib/libc/sys/linux/shlib-compat.h newlib/libc/syscalls/sysisatty.c newlib/testsuite/newlib.stdlib/size_max.c newlib/testsuite/newlib.stdlib/stdlib.exp
Diffstat (limited to 'newlib/libc/string')
-rw-r--r--newlib/libc/string/Makefile.am30
-rw-r--r--newlib/libc/string/Makefile.in63
-rw-r--r--newlib/libc/string/memchr.c81
-rw-r--r--newlib/libc/string/memmem.c102
-rw-r--r--newlib/libc/string/memset.c53
-rw-r--r--newlib/libc/string/str-two-way.h415
-rw-r--r--newlib/libc/string/strcasestr.c57
-rw-r--r--newlib/libc/string/strchr.c69
-rw-r--r--newlib/libc/string/strings.tex4
-rw-r--r--newlib/libc/string/strlen.c42
-rw-r--r--newlib/libc/string/strstr.c54
11 files changed, 161 insertions, 809 deletions
diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am
index 2e7f1fca4..65200cf22 100644
--- a/newlib/libc/string/Makefile.am
+++ b/newlib/libc/string/Makefile.am
@@ -72,9 +72,9 @@ GENERAL_SOURCES = \
wmemset.c
if ELIX_LEVEL_1
-ELIX_2_SOURCES =
+ELIX_SOURCES =
else
-ELIX_2_SOURCES = \
+ELIX_SOURCES = \
bcmp.c \
memccpy.c \
mempcpy.c \
@@ -84,33 +84,18 @@ ELIX_2_SOURCES = \
strcasestr.c \
strndup_r.c \
wcpcpy.c \
- wcpncpy.c
-endif !ELIX_LEVEL_1
-
-if ELIX_LEVEL_1
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_2
-ELIX_4_SOURCES =
-else
-if ELIX_LEVEL_3
-ELIX_4_SOURCES =
-else
-ELIX_4_SOURCES = \
- memmem.c
-endif !ELIX_LEVEL_3
-endif !ELIX_LEVEL_2
-endif !ELIX_LEVEL_1
+ wcpncpy.c \
+endif
libstring_la_LDFLAGS = -Xcompiler -nostdlib
if USE_LIBTOOL
noinst_LTLIBRARIES = libstring.la
-libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
noinst_DATA = objectlist.awk.in
else
noinst_LIBRARIES = lib.a
-lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
lib_a_CFLAGS = $(AM_CFLAGS)
noinst_DATA =
endif # USE_LIBTOOL
@@ -132,8 +117,7 @@ wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
wcsrchr.def wcsspn.def wcsstr.def \
wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \
-wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \
-memmem.def
+wmemcmp.def wmemcpy.def wmemmove.def wmemset.def
SUFFIXES = .def
diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in
index 1c7dfe0cd..16434a87b 100644
--- a/newlib/libc/string/Makefile.in
+++ b/newlib/libc/string/Makefile.in
@@ -46,7 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \
$(top_srcdir)/../../ltoptions.m4 \
$(top_srcdir)/../../ltsugar.m4 \
$(top_srcdir)/../../ltversion.m4 $(top_srcdir)/../acinclude.m4 \
- $(top_srcdir)/configure.in
+ $(top_srcdir)/../confsubdir.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs
@@ -98,32 +98,30 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-strndup_r.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-wcpcpy.$(OBJEXT) \
@ELIX_LEVEL_1_FALSE@ lib_a-wcpncpy.$(OBJEXT)
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_3 = lib_a-memmem.$(OBJEXT)
@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \
-@USE_LIBTOOL_FALSE@ $(am__objects_2) $(am__objects_3)
+@USE_LIBTOOL_FALSE@ $(am__objects_2)
lib_a_OBJECTS = $(am_lib_a_OBJECTS)
LTLIBRARIES = $(noinst_LTLIBRARIES)
libstring_la_LIBADD =
-am__objects_4 = bcopy.lo bzero.lo index.lo memchr.lo memcmp.lo \
+am__objects_3 = bcopy.lo bzero.lo index.lo memchr.lo memcmp.lo \
memcpy.lo memmove.lo memset.lo rindex.lo strcasecmp.lo \
- strcat.lo strchr.lo strcmp.lo strcoll.lo strcpy.lo strcspn.lo \
- strdup.lo strdup_r.lo strerror.lo strerror_r.lo strlcat.lo \
- strlcpy.lo strlen.lo strlwr.lo strncasecmp.lo strncat.lo \
- strncmp.lo strncpy.lo strnlen.lo strpbrk.lo strrchr.lo \
- strsep.lo strspn.lo strtok.lo strtok_r.lo strupr.lo strxfrm.lo \
- strstr.lo swab.lo u_strerr.lo wcscat.lo wcschr.lo wcscmp.lo \
- wcscoll.lo wcscpy.lo wcscspn.lo wcslcat.lo wcslcpy.lo \
- wcslen.lo wcsncat.lo wcsncmp.lo wcsncpy.lo wcsnlen.lo \
- wcspbrk.lo wcsrchr.lo wcsspn.lo wcsstr.lo wcswidth.lo \
- wcsxfrm.lo wcwidth.lo wmemchr.lo wmemcmp.lo wmemcpy.lo \
- wmemmove.lo wmemset.lo
-@ELIX_LEVEL_1_FALSE@am__objects_5 = bcmp.lo memccpy.lo mempcpy.lo \
+ strcat.lo strchr.lo strcmp.lo strcoll.lo strcpy.lo \
+ strcspn.lo strdup.lo strdup_r.lo strerror.lo strerror_r.lo \
+ strlcat.lo strlcpy.lo strlen.lo strlwr.lo strncasecmp.lo \
+ strncat.lo strncmp.lo strncpy.lo strnlen.lo strpbrk.lo \
+ strrchr.lo strsep.lo strspn.lo strtok.lo strtok_r.lo \
+ strupr.lo strxfrm.lo strstr.lo swab.lo u_strerr.lo wcscat.lo \
+ wcschr.lo wcscmp.lo wcscoll.lo wcscpy.lo wcscspn.lo \
+ wcslcat.lo wcslcpy.lo wcslen.lo wcsncat.lo wcsncmp.lo \
+ wcsncpy.lo wcsnlen.lo wcspbrk.lo wcsrchr.lo wcsspn.lo wcsstr.lo \
+ wcswidth.lo wcsxfrm.lo wcwidth.lo wmemchr.lo wmemcmp.lo \
+ wmemcpy.lo wmemmove.lo wmemset.lo
+@ELIX_LEVEL_1_FALSE@am__objects_4 = bcmp.lo memccpy.lo mempcpy.lo \
@ELIX_LEVEL_1_FALSE@ stpcpy.lo stpncpy.lo strndup.lo \
@ELIX_LEVEL_1_FALSE@ strcasestr.lo strndup_r.lo wcpcpy.lo \
@ELIX_LEVEL_1_FALSE@ wcpncpy.lo
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@am__objects_6 = memmem.lo
-@USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_4) \
-@USE_LIBTOOL_TRUE@ $(am__objects_5) $(am__objects_6)
+@USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_3) \
+@USE_LIBTOOL_TRUE@ $(am__objects_4)
libstring_la_OBJECTS = $(am_libstring_la_OBJECTS)
@USE_LIBTOOL_TRUE@am_libstring_la_rpath =
DEFAULT_INCLUDES = -I. -I$(srcdir)
@@ -368,32 +366,26 @@ GENERAL_SOURCES = \
wmemmove.c \
wmemset.c
-@ELIX_LEVEL_1_FALSE@ELIX_2_SOURCES = \
+@ELIX_LEVEL_1_FALSE@ELIX_SOURCES = \
@ELIX_LEVEL_1_FALSE@ bcmp.c \
-@ELIX_LEVEL_1_FALSE@ memccpy.c \
-@ELIX_LEVEL_1_FALSE@ mempcpy.c \
@ELIX_LEVEL_1_FALSE@ stpcpy.c \
@ELIX_LEVEL_1_FALSE@ stpncpy.c \
+@ELIX_LEVEL_1_FALSE@ memccpy.c \
+@ELIX_LEVEL_1_FALSE@ mempcpy.c \
@ELIX_LEVEL_1_FALSE@ strndup.c \
@ELIX_LEVEL_1_FALSE@ strcasestr.c \
@ELIX_LEVEL_1_FALSE@ strndup_r.c \
@ELIX_LEVEL_1_FALSE@ wcpcpy.c \
@ELIX_LEVEL_1_FALSE@ wcpncpy.c
-@ELIX_LEVEL_1_TRUE@ELIX_2_SOURCES =
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ELIX_4_SOURCES = \
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ memmem.c
-
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_4_SOURCES =
-@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_4_SOURCES =
-@ELIX_LEVEL_1_TRUE@ELIX_4_SOURCES =
+@ELIX_LEVEL_1_TRUE@ELIX_SOURCES =
libstring_la_LDFLAGS = -Xcompiler -nostdlib
@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libstring.la
-@USE_LIBTOOL_TRUE@libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+@USE_LIBTOOL_TRUE@libstring_la_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
@USE_LIBTOOL_FALSE@noinst_DATA =
@USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in
@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a
-@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_2_SOURCES) $(ELIX_4_SOURCES)
+@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(GENERAL_SOURCES) $(ELIX_SOURCES)
@USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS)
CHEWOUT_FILES = \
bcmp.def memcpy.def strcmp.def strncat.def strstr.def \
@@ -410,8 +402,7 @@ wcslcat.def wcslcpy.def wcslen.def wcsncat.def \
wcsncmp.def wcsncpy.def wcsnlen.def wcspbrk.def \
wcsrchr.def wcsspn.def wcsstr.def \
wcswidth.def wcsxfrm.def wcwidth.def wmemchr.def \
-wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \
-memmem.def
+wmemcmp.def wmemcpy.def wmemmove.def wmemset.def
SUFFIXES = .def
CHEW = ../../doc/makedoc -f $(srcdir)/../../doc/doc.str
@@ -934,12 +925,6 @@ lib_a-wcpncpy.o: wcpncpy.c
lib_a-wcpncpy.obj: wcpncpy.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcpncpy.obj `if test -f 'wcpncpy.c'; then $(CYGPATH_W) 'wcpncpy.c'; else $(CYGPATH_W) '$(srcdir)/wcpncpy.c'; fi`
-lib_a-memmem.o: memmem.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmem.o `test -f 'memmem.c' || echo '$(srcdir)/'`memmem.c
-
-lib_a-memmem.obj: memmem.c
- $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmem.obj `if test -f 'memmem.c'; then $(CYGPATH_W) 'memmem.c'; else $(CYGPATH_W) '$(srcdir)/memmem.c'; fi`
-
mostlyclean-libtool:
-rm -f *.lo
diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c
index 13ed88186..7c1a584b7 100644
--- a/newlib/libc/string/memchr.c
+++ b/newlib/libc/string/memchr.c
@@ -20,7 +20,7 @@ DESCRIPTION
This function searches memory starting at <<*<[src]>>> for the
character <[c]>. The search only ends with the first
occurrence of <[c]>, or after <[length]> characters; in
- particular, <<NUL>> does not terminate the search.
+ particular, <<NULL>> does not terminate the search.
RETURNS
If the character <[c]> is found within <[length]> characters
@@ -64,9 +64,6 @@ QUICKREF
#error long int is not a 32bit or 64bit byte
#endif
-/* DETECTCHAR returns nonzero if (long)X contains the byte used
- to fill (long)MASK. */
-#define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK))
_PTR
_DEFUN (memchr, (src_void, c, length),
@@ -74,61 +71,73 @@ _DEFUN (memchr, (src_void, c, length),
int c _AND
size_t length)
{
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
_CONST unsigned char *src = (_CONST unsigned char *) src_void;
- unsigned char d = c;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
- unsigned long *asrc;
- unsigned long mask;
- int i;
-
- while (UNALIGNED (src))
+ c &= 0xff;
+
+ while (length--)
{
- if (!length--)
- return NULL;
- if (*src == d)
- return (void *) src;
+ if (*src == c)
+ return (char *) src;
src++;
}
+ return NULL;
+#else
+ _CONST unsigned char *src = (_CONST unsigned char *) src_void;
+ unsigned long *asrc;
+ unsigned long buffer;
+ unsigned long mask;
+ int i, j;
- if (!TOO_SMALL (length))
+ c &= 0xff;
+
+ /* If the size is small, or src is unaligned, then
+ use the bytewise loop. We can hope this is rare. */
+ if (!TOO_SMALL (length) && !UNALIGNED (src))
{
- /* If we get this far, we know that length is large and src is
- word-aligned. */
- /* The fast code reads the source one word at a time and only
+ /* The fast code reads the ASCII one word at a time and only
performs the bytewise search on word-sized segments if they
- contain the search character, which is detected by XORing
+ contain the search character, which is detected by XORing
the word-sized segment with a word-sized block of the search
- character and then detecting for the presence of NUL in the
+ character and then detecting for the presence of NULL in the
result. */
- asrc = (unsigned long *) src;
- mask = d << 8 | d;
- mask = mask << 16 | mask;
- for (i = 32; i < LBLOCKSIZE * 8; i <<= 1)
- mask = (mask << i) | mask;
+ asrc = (unsigned long*) src;
+ mask = 0;
+ for (i = 0; i < LBLOCKSIZE; i++)
+ mask = (mask << 8) + c;
while (length >= LBLOCKSIZE)
{
- if (DETECTCHAR (*asrc, mask))
- break;
+ buffer = *asrc;
+ buffer ^= mask;
+ if (DETECTNULL (buffer))
+ {
+ src = (unsigned char*) asrc;
+ for ( j = 0; j < LBLOCKSIZE; j++ )
+ {
+ if (*src == c)
+ return (char*) src;
+ src++;
+ }
+ }
length -= LBLOCKSIZE;
asrc++;
}
-
+
/* If there are fewer than LBLOCKSIZE characters left,
then we resort to the bytewise loop. */
- src = (unsigned char *) asrc;
+ src = (unsigned char*) asrc;
}
-#endif /* not PREFER_SIZE_OVER_SPEED */
-
while (length--)
- {
- if (*src == d)
- return (void *) src;
+ {
+ if (*src == c)
+ return (char*) src;
src++;
- }
+ }
return NULL;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/memmem.c b/newlib/libc/string/memmem.c
deleted file mode 100644
index 25704e467..000000000
--- a/newlib/libc/string/memmem.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Byte-wise substring search, using the Two-Way algorithm.
- * Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-/*
-FUNCTION
- <<memmem>>---find memory segment
-
-INDEX
- memmem
-
-ANSI_SYNOPSIS
- #include <string.h>
- char *memmem(const void *<[s1]>, size_t <[l1]>, const void *<[s2]>,
- size_t <[l2]>);
-
-DESCRIPTION
-
- Locates the first occurrence in the memory region pointed to
- by <[s1]> with length <[l1]> of the sequence of bytes pointed
- to by <[s2]> of length <[l2]>. If you already know the
- lengths of your haystack and needle, <<memmem>> can be much
- faster than <<strstr>>.
-
-RETURNS
- Returns a pointer to the located segment, or a null pointer if
- <[s2]> is not found. If <[l2]> is 0, <[s1]> is returned.
-
-PORTABILITY
-<<memmem>> is a newlib extension.
-
-<<memmem>> requires no supporting OS subroutines.
-
-QUICKREF
- memmem pure
-*/
-
-#include <string.h>
-
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-# define RETURN_TYPE void *
-# define AVAILABLE(h, h_l, j, n_l) ((j) <= (h_l) - (n_l))
-# include "str-two-way.h"
-#endif
-
-void *
-_DEFUN (memmem, (haystack_start, haystack_len, needle_start, needle_len),
- const void *haystack_start _AND
- size_t haystack_len _AND
- const void *needle_start _AND
- size_t needle_len)
-{
- /* Abstract memory is considered to be an array of 'unsigned char' values,
- not an array of 'char' values. See ISO C 99 section 6.2.6.1. */
- const unsigned char *haystack = (const unsigned char *) haystack_start;
- const unsigned char *needle = (const unsigned char *) needle_start;
-
- if (needle_len == 0)
- /* The first occurrence of the empty string is deemed to occur at
- the beginning of the string. */
- return (void *) haystack;
-
-#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
-
- /* Less code size, but quadratic performance in the worst case. */
- while (needle_len <= haystack_len)
- {
- if (!memcmp (haystack, needle, needle_len))
- return (void *) haystack;
- haystack++;
- haystack_len--;
- }
- return NULL;
-
-#else /* compilation for speed */
-
- /* Larger code size, but guaranteed linear performance. */
-
- /* Sanity check, otherwise the loop might search through the whole
- memory. */
- if (haystack_len < needle_len)
- return NULL;
-
- /* Use optimizations in memchr when possible, to reduce the search
- size of haystack using a linear algorithm with a smaller
- coefficient. However, avoid memchr for long needles, since we
- can often achieve sublinear performance. */
- if (needle_len < LONG_NEEDLE_THRESHOLD)
- {
- haystack = memchr (haystack, *needle, haystack_len);
- if (!haystack || needle_len == 1)
- return (void *) haystack;
- haystack_len -= haystack - (const unsigned char *) haystack_start;
- if (haystack_len < needle_len)
- return NULL;
- return two_way_short_needle (haystack, haystack_len, needle, needle_len);
- }
- return two_way_long_needle (haystack, haystack_len, needle, needle_len);
-#endif /* compilation for speed */
-}
diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c
index 55d2ce180..ac3590ea4 100644
--- a/newlib/libc/string/memset.c
+++ b/newlib/libc/string/memset.c
@@ -7,7 +7,7 @@ INDEX
ANSI_SYNOPSIS
#include <string.h>
- void *memset(void *<[dst]>, int <[c]>, size_t <[length]>);
+ void *memset(const void *<[dst]>, int <[c]>, size_t <[length]>);
TRAD_SYNOPSIS
#include <string.h>
@@ -22,7 +22,7 @@ DESCRIPTION
pointed to by <[dst]> to the value.
RETURNS
- <<memset>> returns the value of <[dst]>.
+ <<memset>> returns the value of <[m]>.
PORTABILITY
<<memset>> is ANSI C.
@@ -39,42 +39,48 @@ QUICKREF
#define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1))
#define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE)
-_PTR
+_PTR
_DEFUN (memset, (m, c, n),
_PTR m _AND
int c _AND
size_t n)
{
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
char *s = (char *) m;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
+ while (n-- != 0)
+ {
+ *s++ = (char) c;
+ }
+
+ return m;
+#else
+ char *s = (char *) m;
int i;
unsigned long buffer;
unsigned long *aligned_addr;
unsigned int d = c & 0xff; /* To avoid sign extension, copy C to an
unsigned variable. */
- while (UNALIGNED (s))
+ if (!TOO_SMALL (n) && !UNALIGNED (m))
{
- if (n--)
- *s++ = (char) c;
- else
- return m;
- }
-
- if (!TOO_SMALL (n))
- {
- /* If we get this far, we know that n is large and s is word-aligned. */
- aligned_addr = (unsigned long *) s;
+ /* If we get this far, we know that n is large and m is word-aligned. */
+ aligned_addr = (unsigned long*)m;
/* Store D into each char sized location in BUFFER so that
we can set large blocks quickly. */
- buffer = (d << 8) | d;
- buffer |= (buffer << 16);
- for (i = 32; i < LBLOCKSIZE * 8; i <<= 1)
- buffer = (buffer << i) | buffer;
+ if (LBLOCKSIZE == 4)
+ {
+ buffer = (d << 8) | d;
+ buffer |= (buffer << 16);
+ }
+ else
+ {
+ buffer = 0;
+ for (i = 0; i < LBLOCKSIZE; i++)
+ buffer = (buffer << 8) | d;
+ }
- /* Unroll the loop. */
while (n >= LBLOCKSIZE*4)
{
*aligned_addr++ = buffer;
@@ -93,10 +99,11 @@ _DEFUN (memset, (m, c, n),
s = (char*)aligned_addr;
}
-#endif /* not PREFER_SIZE_OVER_SPEED */
-
while (n--)
- *s++ = (char) c;
+ {
+ *s++ = (char)d;
+ }
return m;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/str-two-way.h b/newlib/libc/string/str-two-way.h
deleted file mode 100644
index ad71a2595..000000000
--- a/newlib/libc/string/str-two-way.h
+++ /dev/null
@@ -1,415 +0,0 @@
-/* Byte-wise substring search, using the Two-Way algorithm.
- * Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute this software
- * is freely granted, provided that this notice is preserved.
- */
-
-
-/* Before including this file, you need to include <string.h>, and define:
- RESULT_TYPE A macro that expands to the return type.
- AVAILABLE(h, h_l, j, n_l) A macro that returns nonzero if there are
- at least N_L bytes left starting at
- H[J]. H is 'unsigned char *', H_L, J,
- and N_L are 'size_t'; H_L is an
- lvalue. For NUL-terminated searches,
- H_L can be modified each iteration to
- avoid having to compute the end of H
- up front.
-
- For case-insensitivity, you may optionally define:
- CMP_FUNC(p1, p2, l) A macro that returns 0 iff the first L
- characters of P1 and P2 are equal.
- CANON_ELEMENT(c) A macro that canonicalizes an element
- right after it has been fetched from
- one of the two strings. The argument
- is an 'unsigned char'; the result must
- be an 'unsigned char' as well.
-
- This file undefines the macros documented above, and defines
- LONG_NEEDLE_THRESHOLD.
-*/
-
-#include <limits.h>
-#include <stdint.h>
-
-/* We use the Two-Way string matching algorithm, which guarantees
- linear complexity with constant space. Additionally, for long
- needles, we also use a bad character shift table similar to the
- Boyer-Moore algorithm to achieve improved (potentially sub-linear)
- performance.
-
- See http://www-igm.univ-mlv.fr/~lecroq/string/node26.html#SECTION00260
- and http://en.wikipedia.org/wiki/Boyer-Moore_string_search_algorithm
-*/
-
-/* Point at which computing a bad-byte shift table is likely to be
- worthwhile. Small needles should not compute a table, since it
- adds (1 << CHAR_BIT) + NEEDLE_LEN computations of preparation for a
- speedup no greater than a factor of NEEDLE_LEN. The larger the
- needle, the better the potential performance gain. On the other
- hand, on non-POSIX systems with CHAR_BIT larger than eight, the
- memory required for the table is prohibitive. */
-#if CHAR_BIT < 10
-# define LONG_NEEDLE_THRESHOLD 32U
-#else
-# define LONG_NEEDLE_THRESHOLD SIZE_MAX
-#endif
-
-#define MAX(a, b) ((a < b) ? (b) : (a))
-
-#ifndef CANON_ELEMENT
-# define CANON_ELEMENT(c) c
-#endif
-#ifndef CMP_FUNC
-# define CMP_FUNC memcmp
-#endif
-
-/* Perform a critical factorization of NEEDLE, of length NEEDLE_LEN.
- Return the index of the first byte in the right half, and set
- *PERIOD to the global period of the right half.
-
- The global period of a string is the smallest index (possibly its
- length) at which all remaining bytes in the string are repetitions
- of the prefix (the last repetition may be a subset of the prefix).
-
- When NEEDLE is factored into two halves, a local period is the
- length of the smallest word that shares a suffix with the left half
- and shares a prefix with the right half. All factorizations of a
- non-empty NEEDLE have a local period of at least 1 and no greater
- than NEEDLE_LEN.
-
- A critical factorization has the property that the local period
- equals the global period. All strings have at least one critical
- factorization with the left half smaller than the global period.
-
- Given an ordered alphabet, a critical factorization can be computed
- in linear time, with 2 * NEEDLE_LEN comparisons, by computing the
- larger of two ordered maximal suffixes. The ordered maximal
- suffixes are determined by lexicographic comparison of
- periodicity. */
-static size_t
-critical_factorization (const unsigned char *needle, size_t needle_len,
- size_t *period)
-{
- /* Index of last byte of left half, or SIZE_MAX. */
- size_t max_suffix, max_suffix_rev;
- size_t j; /* Index into NEEDLE for current candidate suffix. */
- size_t k; /* Offset into current period. */
- size_t p; /* Intermediate period. */
- unsigned char a, b; /* Current comparison bytes. */
-
- /* Invariants:
- 0 <= j < NEEDLE_LEN - 1
- -1 <= max_suffix{,_rev} < j (treating SIZE_MAX as if it were signed)
- min(max_suffix, max_suffix_rev) < global period of NEEDLE
- 1 <= p <= global period of NEEDLE
- p == global period of the substring NEEDLE[max_suffix{,_rev}+1...j]
- 1 <= k <= p
- */
-
- /* Perform lexicographic search. */
- max_suffix = SIZE_MAX;
- j = 0;
- k = p = 1;
- while (j + k < needle_len)
- {
- a = CANON_ELEMENT (needle[j + k]);
- b = CANON_ELEMENT (needle[max_suffix + k]);
- if (a < b)
- {
- /* Suffix is smaller, period is entire prefix so far. */
- j += k;
- k = 1;
- p = j - max_suffix;
- }
- else if (a == b)
- {
- /* Advance through repetition of the current period. */
- if (k != p)
- ++k;
- else
- {
- j += p;
- k = 1;
- }
- }
- else /* b < a */
- {
- /* Suffix is larger, start over from current location. */
- max_suffix = j++;
- k = p = 1;
- }
- }
- *period = p;
-
- /* Perform reverse lexicographic search. */
- max_suffix_rev = SIZE_MAX;
- j = 0;
- k = p = 1;
- while (j + k < needle_len)
- {
- a = CANON_ELEMENT (needle[j + k]);
- b = CANON_ELEMENT (needle[max_suffix_rev + k]);
- if (b < a)
- {
- /* Suffix is smaller, period is entire prefix so far. */
- j += k;
- k = 1;
- p = j - max_suffix_rev;
- }
- else if (a == b)
- {
- /* Advance through repetition of the current period. */
- if (k != p)
- ++k;
- else
- {
- j += p;
- k = 1;
- }
- }
- else /* a < b */
- {
- /* Suffix is larger, start over from current location. */
- max_suffix_rev = j++;
- k = p = 1;
- }
- }
-
- /* Choose the longer suffix. Return the first byte of the right
- half, rather than the last byte of the left half. */
- if (max_suffix_rev + 1 < max_suffix + 1)
- return max_suffix + 1;
- *period = p;
- return max_suffix_rev + 1;
-}
-
-/* Return the first location of non-empty NEEDLE within HAYSTACK, or
- NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
- method is optimized for NEEDLE_LEN < LONG_NEEDLE_THRESHOLD.
- Performance is guaranteed to be linear, with an initialization cost
- of 2 * NEEDLE_LEN comparisons.
-
- If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
- most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching.
- If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
- HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching. */
-static RETURN_TYPE
-two_way_short_needle (const unsigned char *haystack, size_t haystack_len,
- const unsigned char *needle, size_t needle_len)
-{
- size_t i; /* Index into current byte of NEEDLE. */
- size_t j; /* Index into current window of HAYSTACK. */
- size_t period; /* The period of the right half of needle. */
- size_t suffix; /* The index of the right half of needle. */
-
- /* Factor the needle into two halves, such that the left half is
- smaller than the global period, and the right half is
- periodic (with a period as large as NEEDLE_LEN - suffix). */
- suffix = critical_factorization (needle, needle_len, &period);
-
- /* Perform the search. Each iteration compares the right half
- first. */
- if (CMP_FUNC (needle, needle + period, suffix) == 0)
- {
- /* Entire needle is periodic; a mismatch can only advance by the
- period, so use memory to avoid rescanning known occurrences
- of the period. */
- size_t memory = 0;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Scan for matches in right half. */
- i = MAX (suffix, memory);
- while (i < needle_len && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (memory < i + 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i + 1 < memory + 1)
- return (RETURN_TYPE) (haystack + j);
- /* No match, so remember how many repetitions of period
- on the right half were scanned. */
- j += period;
- memory = needle_len - period;
- }
- else
- {
- j += i - suffix + 1;
- memory = 0;
- }
- }
- }
- else
- {
- /* The two halves of needle are distinct; no extra memory is
- required, and any mismatch results in a maximal shift. */
- period = MAX (suffix, needle_len - suffix) + 1;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Scan for matches in right half. */
- i = suffix;
- while (i < needle_len && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i == SIZE_MAX)
- return (RETURN_TYPE) (haystack + j);
- j += period;
- }
- else
- j += i - suffix + 1;
- }
- }
- return NULL;
-}
-
-/* Return the first location of non-empty NEEDLE within HAYSTACK, or
- NULL. HAYSTACK_LEN is the minimum known length of HAYSTACK. This
- method is optimized for LONG_NEEDLE_THRESHOLD <= NEEDLE_LEN.
- Performance is guaranteed to be linear, with an initialization cost
- of 3 * NEEDLE_LEN + (1 << CHAR_BIT) operations.
-
- If AVAILABLE does not modify HAYSTACK_LEN (as in memmem), then at
- most 2 * HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching,
- and sublinear performance O(HAYSTACK_LEN / NEEDLE_LEN) is possible.
- If AVAILABLE modifies HAYSTACK_LEN (as in strstr), then at most 3 *
- HAYSTACK_LEN - NEEDLE_LEN comparisons occur in searching, and
- sublinear performance is not possible. */
-static RETURN_TYPE
-two_way_long_needle (const unsigned char *haystack, size_t haystack_len,
- const unsigned char *needle, size_t needle_len)
-{
- size_t i; /* Index into current byte of NEEDLE. */
- size_t j; /* Index into current window of HAYSTACK. */
- size_t period; /* The period of the right half of needle. */
- size_t suffix; /* The index of the right half of needle. */
- size_t shift_table[1U << CHAR_BIT]; /* See below. */
-
- /* Factor the needle into two halves, such that the left half is
- smaller than the global period, and the right half is
- periodic (with a period as large as NEEDLE_LEN - suffix). */
- suffix = critical_factorization (needle, needle_len, &period);
-
- /* Populate shift_table. For each possible byte value c,
- shift_table[c] is the distance from the last occurrence of c to
- the end of NEEDLE, or NEEDLE_LEN if c is absent from the NEEDLE.
- shift_table[NEEDLE[NEEDLE_LEN - 1]] contains the only 0. */
- for (i = 0; i < 1U << CHAR_BIT; i++)
- shift_table[i] = needle_len;
- for (i = 0; i < needle_len; i++)
- shift_table[CANON_ELEMENT (needle[i])] = needle_len - i - 1;
-
- /* Perform the search. Each iteration compares the right half
- first. */
- if (CMP_FUNC (needle, needle + period, suffix) == 0)
- {
- /* Entire needle is periodic; a mismatch can only advance by the
- period, so use memory to avoid rescanning known occurrences
- of the period. */
- size_t memory = 0;
- size_t shift;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Check the last byte first; if it does not match, then
- shift to the next possible match location. */
- shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
- if (0 < shift)
- {
- if (memory && shift < period)
- {
- /* Since needle is periodic, but the last period has
- a byte out of place, there can be no match until
- after the mismatch. */
- shift = needle_len - period;
- memory = 0;
- }
- j += shift;
- continue;
- }
- /* Scan for matches in right half. The last byte has
- already been matched, by virtue of the shift table. */
- i = MAX (suffix, memory);
- while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len - 1 <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (memory < i + 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i + 1 < memory + 1)
- return (RETURN_TYPE) (haystack + j);
- /* No match, so remember how many repetitions of period
- on the right half were scanned. */
- j += period;
- memory = needle_len - period;
- }
- else
- {
- j += i - suffix + 1;
- memory = 0;
- }
- }
- }
- else
- {
- /* The two halves of needle are distinct; no extra memory is
- required, and any mismatch results in a maximal shift. */
- size_t shift;
- period = MAX (suffix, needle_len - suffix) + 1;
- j = 0;
- while (AVAILABLE (haystack, haystack_len, j, needle_len))
- {
- /* Check the last byte first; if it does not match, then
- shift to the next possible match location. */
- shift = shift_table[CANON_ELEMENT (haystack[j + needle_len - 1])];
- if (0 < shift)
- {
- j += shift;
- continue;
- }
- /* Scan for matches in right half. The last byte has
- already been matched, by virtue of the shift table. */
- i = suffix;
- while (i < needle_len - 1 && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- ++i;
- if (needle_len - 1 <= i)
- {
- /* Scan for matches in left half. */
- i = suffix - 1;
- while (i != SIZE_MAX && (CANON_ELEMENT (needle[i])
- == CANON_ELEMENT (haystack[i + j])))
- --i;
- if (i == SIZE_MAX)
- return (RETURN_TYPE) (haystack + j);
- j += period;
- }
- else
- j += i - suffix + 1;
- }
- }
- return NULL;
-}
-
-#undef AVAILABLE
-#undef CANON_ELEMENT
-#undef CMP_FUNC
-#undef MAX
-#undef RETURN_TYPE
diff --git a/newlib/libc/string/strcasestr.c b/newlib/libc/string/strcasestr.c
index a8276e2b5..4f6f87e97 100644
--- a/newlib/libc/string/strcasestr.c
+++ b/newlib/libc/string/strcasestr.c
@@ -1,7 +1,7 @@
/*
FUNCTION
<<strcasestr>>---case-insensitive character string search
-
+
INDEX
strcasestr
@@ -21,9 +21,9 @@ DESCRIPTION
is identical to <<strstr>> except the search is
case-insensitive.
-RETURNS
+RETURNS
- A pointer to the first case-insensitive occurrence of the sequence
+ A pointer to the first case-insensitive occurrence of the sequence
<[find]> or <<NULL>> if no match was found.
PORTABILITY
@@ -40,7 +40,7 @@ QUICKREF
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
- * The quadratic code is derived from software contributed to Berkeley by
+ * This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* Redistribution and use in source and binary forms, with or without
@@ -67,26 +67,12 @@ QUICKREF
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-/* Linear algorithm Copyright (C) 2008 Eric Blake
- * Permission to use, copy, modify, and distribute the linear portion of
- * software is freely granted, provided that this notice is preserved.
- */
#include <sys/cdefs.h>
#include <ctype.h>
#include <string.h>
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-# define RETURN_TYPE char *
-# define AVAILABLE(h, h_l, j, n_l) \
- (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
- && ((h_l) = (j) + (n_l)))
-# define CANON_ELEMENT(c) tolower (c)
-# define CMP_FUNC strncasecmp
-# include "str-two-way.h"
-#endif
-
/*
* Find the first occurrence of find in s, ignore case.
*/
@@ -94,9 +80,6 @@ char *
strcasestr(s, find)
const char *s, *find;
{
-#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
-
- /* Less code size, but quadratic performance in the worst case. */
char c, sc;
size_t len;
@@ -112,36 +95,4 @@ strcasestr(s, find)
s--;
}
return ((char *)s);
-
-#else /* compilation for speed */
-
- /* Larger code size, but guaranteed linear performance. */
- const char *haystack = s;
- const char *needle = find;
- size_t needle_len; /* Length of NEEDLE. */
- size_t haystack_len; /* Known minimum length of HAYSTACK. */
- int ok = 1; /* True if NEEDLE is prefix of HAYSTACK. */
-
- /* Determine length of NEEDLE, and in the process, make sure
- HAYSTACK is at least as long (no point processing all of a long
- NEEDLE if HAYSTACK is too short). */
- while (*haystack && *needle)
- ok &= (tolower ((unsigned char) *haystack++)
- == tolower ((unsigned char) *needle++));
- if (*needle)
- return NULL;
- if (ok)
- return (char *) s;
- needle_len = needle - find;
- haystack = s + 1;
- haystack_len = needle_len - 1;
-
- /* Perform the search. */
- if (needle_len < LONG_NEEDLE_THRESHOLD)
- return two_way_short_needle ((const unsigned char *) haystack,
- haystack_len,
- (const unsigned char *) find, needle_len);
- return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
- (const unsigned char *) find, needle_len);
-#endif /* compilation for speed */
}
diff --git a/newlib/libc/string/strchr.c b/newlib/libc/string/strchr.c
index e921b5db7..60b0fde8e 100644
--- a/newlib/libc/string/strchr.c
+++ b/newlib/libc/string/strchr.c
@@ -53,7 +53,7 @@ QUICKREF
#endif
#endif
-/* DETECTCHAR returns nonzero if (long)X contains the byte used
+/* DETECTCHAR returns nonzero if (long)X contains the byte used
to fill (long)MASK. */
#define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK))
@@ -63,61 +63,46 @@ _DEFUN (strchr, (s1, i),
int i)
{
_CONST unsigned char *s = (_CONST unsigned char *)s1;
- unsigned char c = i;
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
+ unsigned char c = (unsigned int)i;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
- unsigned long mask,j;
- unsigned long *aligned_addr;
-
- /* Special case for finding 0. */
- if (!c)
+ while (*s && *s != c)
{
- while (UNALIGNED (s))
- {
- if (!*s)
- return (char *) s;
- s++;
- }
- /* Operate a word at a time. */
- aligned_addr = (unsigned long *) s;
- while (!DETECTNULL (*aligned_addr))
- aligned_addr++;
- /* Found the end of string. */
- s = (const unsigned char *) aligned_addr;
- while (*s)
- s++;
- return (char *) s;
+ s++;
}
- /* All other bytes. Align the pointer, then search a long at a time. */
- while (UNALIGNED (s))
+ if (*s != c)
{
- if (!*s)
- return NULL;
- if (*s == c)
- return (char *) s;
- s++;
+ s = NULL;
}
- mask = c;
- for (j = 8; j < LBLOCKSIZE * 8; j <<= 1)
- mask = (mask << j) | mask;
+ return (char *) s;
+#else
+ unsigned char c = (unsigned char)i;
+ unsigned long mask,j;
+ unsigned long *aligned_addr;
- aligned_addr = (unsigned long *) s;
- while (!DETECTNULL (*aligned_addr) && !DETECTCHAR (*aligned_addr, mask))
- aligned_addr++;
+ if (!UNALIGNED (s))
+ {
+ mask = 0;
+ for (j = 0; j < LBLOCKSIZE; j++)
+ mask = (mask << 8) | c;
- /* The block of bytes currently pointed to by aligned_addr
- contains either a null or the target char, or both. We
- catch it using the bytewise search. */
+ aligned_addr = (unsigned long*)s;
+ while (!DETECTNULL (*aligned_addr) && !DETECTCHAR (*aligned_addr, mask))
+ aligned_addr++;
- s = (unsigned char *) aligned_addr;
+ /* The block of bytes currently pointed to by aligned_addr
+ contains either a null or the target char, or both. We
+ catch it using the bytewise search. */
-#endif /* not PREFER_SIZE_OVER_SPEED */
+ s = (unsigned char*)aligned_addr;
+ }
while (*s && *s != c)
- s++;
+ s++;
if (*s == c)
return (char *)s;
return NULL;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex
index 6750f3eb0..5ba6e0fe5 100644
--- a/newlib/libc/string/strings.tex
+++ b/newlib/libc/string/strings.tex
@@ -14,7 +14,6 @@ managing areas of memory. The corresponding declarations are in
* memchr:: Find character in memory
* memcmp:: Compare two memory areas
* memcpy:: Copy memory regions
-* memmem:: Find memory segment
* memmove:: Move possibly overlapping memory
* mempcpy:: Copy memory regions and locate end
* memset:: Set an area of memory
@@ -73,9 +72,6 @@ managing areas of memory. The corresponding declarations are in
@include string/memcpy.def
@page
-@include string/memmem.def
-
-@page
@include string/memmove.def
@page
diff --git a/newlib/libc/string/strlen.c b/newlib/libc/string/strlen.c
index a796d2738..4249e14c7 100644
--- a/newlib/libc/string/strlen.c
+++ b/newlib/libc/string/strlen.c
@@ -1,7 +1,7 @@
-/*
+/*
FUNCTION
<<strlen>>---character string length
-
+
INDEX
strlen
@@ -57,32 +57,32 @@ size_t
_DEFUN (strlen, (str),
_CONST char *str)
{
+#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
_CONST char *start = str;
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
+ while (*str)
+ str++;
+
+ return str - start;
+#else
+ _CONST char *start = str;
unsigned long *aligned_addr;
- /* Align the pointer, so we can search a word at a time. */
- while (UNALIGNED (str))
+ if (!UNALIGNED (str))
{
- if (!*str)
- return str - start;
- str++;
+ /* If the string is word-aligned, we can check for the presence of
+ a null in each word-sized block. */
+ aligned_addr = (unsigned long*)str;
+ while (!DETECTNULL (*aligned_addr))
+ aligned_addr++;
+
+ /* Once a null is detected, we check each byte in that block for a
+ precise position of the null. */
+ str = (char*)aligned_addr;
}
-
- /* If the string is word-aligned, we can check for the presence of
- a null in each word-sized block. */
- aligned_addr = (unsigned long *)str;
- while (!DETECTNULL (*aligned_addr))
- aligned_addr++;
-
- /* Once a null is detected, we check each byte in that block for a
- precise position of the null. */
- str = (char *) aligned_addr;
-
-#endif /* not PREFER_SIZE_OVER_SPEED */
-
+
while (*str)
str++;
return str - start;
+#endif /* not PREFER_SIZE_OVER_SPEED */
}
diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c
index 0480bce0a..dddced3b2 100644
--- a/newlib/libc/string/strstr.c
+++ b/newlib/libc/string/strstr.c
@@ -16,14 +16,14 @@ TRAD_SYNOPSIS
char *<[s2]>;
DESCRIPTION
- Locates the first occurrence in the string pointed to by <[s1]> of
+ Locates the first occurence in the string pointed to by <[s1]> of
the sequence of characters in the string pointed to by <[s2]>
- (excluding the terminating null character).
+ (excluding the terminating null character).
RETURNS
Returns a pointer to the located string segment, or a null
pointer if the string <[s2]> is not found. If <[s2]> points to
- a string with zero length, <[s1]> is returned.
+ a string with zero length, the <[s1]> is returned.
PORTABILITY
<<strstr>> is ANSI C.
@@ -36,22 +36,11 @@ QUICKREF
#include <string.h>
-#if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__)
-# define RETURN_TYPE char *
-# define AVAILABLE(h, h_l, j, n_l) \
- (!memchr ((h) + (h_l), '\0', (j) + (n_l) - (h_l)) \
- && ((h_l) = (j) + (n_l)))
-# include "str-two-way.h"
-#endif
-
char *
_DEFUN (strstr, (searchee, lookfor),
_CONST char *searchee _AND
_CONST char *lookfor)
{
-#if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__)
-
- /* Less code size, but quadratic performance in the worst case. */
if (*searchee == 0)
{
if (*lookfor)
@@ -81,41 +70,4 @@ _DEFUN (strstr, (searchee, lookfor),
}
return (char *) NULL;
-
-#else /* compilation for speed */
-
- /* Larger code size, but guaranteed linear performance. */
- const char *haystack = searchee;
- const char *needle = lookfor;
- size_t needle_len; /* Length of NEEDLE. */
- size_t haystack_len; /* Known minimum length of HAYSTACK. */
- int ok = 1; /* True if NEEDLE is prefix of HAYSTACK. */
-
- /* Determine length of NEEDLE, and in the process, make sure
- HAYSTACK is at least as long (no point processing all of a long
- NEEDLE if HAYSTACK is too short). */
- while (*haystack && *needle)
- ok &= *haystack++ == *needle++;
- if (*needle)
- return NULL;
- if (ok)
- return (char *) searchee;
-
- /* Reduce the size of haystack using strchr, since it has a smaller
- linear coefficient than the Two-Way algorithm. */
- needle_len = needle - lookfor;
- haystack = strchr (searchee + 1, *lookfor);
- if (!haystack || needle_len == 1)
- return (char *) haystack;
- haystack_len = (haystack > searchee + needle_len ? 1
- : needle_len + searchee - haystack);
-
- /* Perform the search. */
- if (needle_len < LONG_NEEDLE_THRESHOLD)
- return two_way_short_needle ((const unsigned char *) haystack,
- haystack_len,
- (const unsigned char *) lookfor, needle_len);
- return two_way_long_needle ((const unsigned char *) haystack, haystack_len,
- (const unsigned char *) lookfor, needle_len);
-#endif /* compilation for speed */
}