remove #undef strlen, use #define strlen always but without xfunc/BB_STRLEN_IMPLEMENT...
author"Vladimir N. Oleynik" <dzo@simtreas.ru>
Mon, 20 Feb 2006 12:15:10 +0000 (12:15 -0000)
committer"Vladimir N. Oleynik" <dzo@simtreas.ru>
Mon, 20 Feb 2006 12:15:10 +0000 (12:15 -0000)
include/libbb.h
libbb/xfuncs.c

index 8ec1a24c013b7fa90fb05466629c93c0d36d75f1..9f0c85b03d5e80495975376399483ba8a9c5c36f 100644 (file)
@@ -387,7 +387,9 @@ void reset_ino_dev_hashtable(void);
 
 /* Stupid gcc always includes its own builtin strlen()... */
 extern size_t bb_strlen(const char *string);
+#ifndef BB_STRLEN_IMPLEMENTATION
 #define strlen(x)   bb_strlen(x)
+#endif
 
 char *bb_xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
 
index 69eaf79e0c6afea6c67efd814b2d7ed6c48af1c9..6d54c1a794f931e5919fee4042dadf69e15061f1 100644 (file)
 #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"
 
 
@@ -167,9 +174,6 @@ extern void bb_xfflush_stdout(void)
 #endif
 
 #ifdef L_strlen
-/* 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 */
-#undef strlen
 size_t bb_strlen(const char *string)
 {
            return(strlen(string));