summaryrefslogtreecommitdiff
path: root/libbb/xfuncs.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer2006-05-19 10:43:32 +0000
committerBernhard Reutner-Fischer2006-05-19 10:43:32 +0000
commit0e37af831d707494a86111755a3530b707d1035c (patch)
tree472954b39a7e9ec2c319971f028b2111f7b6f86e /libbb/xfuncs.c
parent006955556f9677ecf73aac582497f6efc47d383f (diff)
downloadbusybox-0e37af831d707494a86111755a3530b707d1035c.zip
busybox-0e37af831d707494a86111755a3530b707d1035c.tar.gz
- make sure not to trip enless loops when using strlen in IMA mode.
(r15000 from trunk plus preprocessor fixes plus repair of commit message)
Diffstat (limited to 'libbb/xfuncs.c')
-rw-r--r--libbb/xfuncs.c13
1 files changed, 4 insertions, 9 deletions
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 <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
-
-/* 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