Remove bb_strlen() in favor of -fno-builtin-strlen. Saves as many bytes

as the old optimization did (actually does slightly better under gcc 4.0), and
simplifies the code.
This commit is contained in:
Rob Landley
2006-05-07 20:20:34 +00:00
parent f8a8084267
commit a389651115
14 changed files with 37 additions and 50 deletions

View File

@@ -69,7 +69,7 @@ $(LIBBB_MOBJ0):$(LIBBB_MSRC0)
LIBBB_MSRC1:=$(srcdir)/xfuncs.c
LIBBB_MOBJ1:=xmalloc.o xrealloc.o xcalloc.o xstrdup.o xstrndup.o \
xfopen.o xopen.o xopen3.o xread.o xread_all.o xread_char.o \
xferror.o xferror_stdout.o xfflush_stdout.o strlen.o
xferror.o xferror_stdout.o xfflush_stdout.o
LIBBB_MOBJ1:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ1))
$(LIBBB_MOBJ1):$(LIBBB_MSRC1)
$(compile.c) -DL_$(notdir $*)
@@ -101,7 +101,7 @@ $(LIBBB_MOBJ5):$(LIBBB_MSRC5)
$(compile.c) -DL_$(notdir $*)
LIBBB_MSRC6:=$(srcdir)/llist.c
LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_free_one.o llist_free.o
LIBBB_MOBJ6:=llist_add_to.o llist_add_to_end.o llist_pop.o llist_free.o
LIBBB_MOBJ6:=$(patsubst %,$(LIBBB_DIR)/%, $(LIBBB_MOBJ6))
$(LIBBB_MOBJ6):$(LIBBB_MSRC6)
$(compile.c) -DL_$(notdir $*)

View File

@@ -72,6 +72,6 @@ int correct_password ( const struct passwd *pw )
return 0;
}
encrypted = crypt ( unencrypted, correct );
memset ( unencrypted, 0, bb_strlen ( unencrypted ));
memset ( unencrypted, 0, strlen ( unencrypted ));
return ( strcmp ( encrypted, correct ) == 0 ) ? 1 : 0;
}

View File

@@ -174,15 +174,6 @@ void bb_xfflush_stdout(void)
}
#endif
// GCC forces inlining of strlen everywhere, which is generally a byte
// larger than calling a function, and it's called a lot so it adds up.
#ifdef L_strlen
size_t bb_strlen(const char *string)
{
return(__builtin_strlen(string));
}
#endif
/* END CODE */
/*
Local Variables: