aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-19 10:43:32 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-05-19 10:43:32 +0000
commit0e37af831d707494a86111755a3530b707d1035c (patch)
tree472954b39a7e9ec2c319971f028b2111f7b6f86e /libbb
parent006955556f9677ecf73aac582497f6efc47d383f (diff)
downloadbusybox-w32-0e37af831d707494a86111755a3530b707d1035c.tar.gz
busybox-w32-0e37af831d707494a86111755a3530b707d1035c.tar.bz2
busybox-w32-0e37af831d707494a86111755a3530b707d1035c.zip
- 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')
-rw-r--r--libbb/xfuncs.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c
index 9ee4fcd65..8bb75f612 100644
--- a/libbb/xfuncs.c
+++ b/libbb/xfuncs.c
@@ -14,16 +14,8 @@
14#include <stdlib.h> 14#include <stdlib.h>
15#include <unistd.h> 15#include <unistd.h>
16#include <fcntl.h> 16#include <fcntl.h>
17
18/* Since gcc always inlines strlen(), this saves a byte or two, but we need
19 * the #undef here to avoid endless loop from #define strlen bb_strlen */
20#ifdef L_strlen
21#define BB_STRLEN_IMPLEMENTATION
22#endif
23
24#include "libbb.h" 17#include "libbb.h"
25 18
26
27#ifndef DMALLOC 19#ifndef DMALLOC
28#ifdef L_xmalloc 20#ifdef L_xmalloc
29void *xmalloc(size_t size) 21void *xmalloc(size_t size)
@@ -175,10 +167,13 @@ void bb_xfflush_stdout(void)
175} 167}
176#endif 168#endif
177 169
170/* GCC forces inlining of strlen everywhere, which is generally a byte
171 larger than calling a function, and it's called a lot so it adds up.
172*/
178#ifdef L_strlen 173#ifdef L_strlen
179size_t bb_strlen(const char *string) 174size_t bb_strlen(const char *string)
180{ 175{
181 return(strlen(string)); 176 return(__builtin_strlen(string));
182} 177}
183#endif 178#endif
184 179