From 0e37af831d707494a86111755a3530b707d1035c Mon Sep 17 00:00:00 2001 From: Bernhard Reutner-Fischer Date: Fri, 19 May 2006 10:43:32 +0000 Subject: - make sure not to trip enless loops when using strlen in IMA mode. (r15000 from trunk plus preprocessor fixes plus repair of commit message) --- libbb/xfuncs.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'libbb') diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 9ee4fcd..8bb75f6 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c @@ -14,16 +14,8 @@ #include #include #include - -/* Since gcc always inlines strlen(), this saves a byte or two, but we need - * the #undef here to avoid endless loop from #define strlen bb_strlen */ -#ifdef L_strlen -#define BB_STRLEN_IMPLEMENTATION -#endif - #include "libbb.h" - #ifndef DMALLOC #ifdef L_xmalloc void *xmalloc(size_t size) @@ -175,10 +167,13 @@ 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(strlen(string)); + return(__builtin_strlen(string)); } #endif -- cgit v1.1