aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
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