[net.news.b] Fix for "Not contributor" - USG strchr

rjk@mgweed.UUCP (Randy King) (03/16/84)

One possible reason for changing the BSD string index functions
into the USG string functions is that items in string(3) like
strchr, strcmp, etc. are implemented in hardware on the AT&T
processors.  Calling one of these functions traps to some
microcode instructions and is obviously faster.

						Randy King
						AT&T/CP-MG
						ihnp4!mgweed!rjk

rees@apollo.uucp (Jim Rees) (03/17/84)

I'm not convinced.  The file funcs.c contains source code for
index() and rindex().  Makefile compiles this source file with
the flags "-Dindex=strchr -Drindex=strrchr".  So you end up with
a funcs.o containing definitions for strchr and strrchr, and
they certainly don't make use of the hardware instructions.
When inews is bound together by ld, all of the calls to strchr
and strrchr will be pointed at the ones defined in funcs.o, not
the fast assembler-coded ones in /lib/libc.a.

It seems to me that we should:

1.  Drop the definitions of index() and rindex() from funcs.c.

2.  Leave the -Dindex=strchr in the USG version of Makefile.

3.  Sites that don't have either index-rindex or strchr-strrchr
    will just have to write them, or we could send along the
    definitions from funcs.c but in a separate source file.

Alternatively, if we are going to continue to suppply index()-rindex()
in funcs.c, it makes absolutely no sense to leave the -Dindex stuff
in the makefile, as far as I can tell.