From 556596206c4c6b97a575fa2a1a89877027340af8 Mon Sep 17 00:00:00 2001
From: Sam Liddicott <sam@liddicott.com>
Date: Thu, 16 May 2013 16:38:52 +0100
Subject: [PATCH] Support compilers without nested functions

Use alternative to nested functions in find.c

My 64 bit build shows absolutely no difference in final size of busybox

Signed-off-by: Sam Liddicott <sam@liddicott.com>
---
 findutils/find.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/findutils/find.c b/findutils/find.c
index 2235b50..a503224 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -905,6 +905,19 @@ static action*** parse_params(char **argv)
 	unsigned cur_action = 0;
 	IF_FEATURE_FIND_NOT( bool invert_flag = 0; )
 
+#ifdef NO_NESTED_FUNCTIONS
+	action *__tmp_ap__;
+#define alloc_action(int_sizeof_struct, action_fp_f) \
+	( \
+		appp[cur_group] = xrealloc(appp[cur_group], (cur_action+2) * sizeof(*appp)), \
+		appp[cur_group][cur_action++] = __tmp_ap__ = xzalloc(int_sizeof_struct), \
+		appp[cur_group][cur_action] = NULL, \
+		__tmp_ap__->f = action_fp_f, \
+		IF_FEATURE_FIND_NOT( __tmp_ap__->invert = invert_flag ) IF_NOT_FEATURE_FIND_NOT(((void)0)), \
+		IF_FEATURE_FIND_NOT( invert_flag = 0 ) IF_NOT_FEATURE_FIND_NOT(((void)0)), \
+		__tmp_ap__ \
+	)
+#else
 	/* This is the only place in busybox where we use nested function.
 	 * So far more standard alternatives were bigger. */
 	/* Auto decl suppresses "func without a prototype" warning: */
@@ -920,6 +933,7 @@ static action*** parse_params(char **argv)
 		IF_FEATURE_FIND_NOT( invert_flag = 0; )
 		return ap;
 	}
+#endif
 
 #define ALLOC_ACTION(name) (action_##name*)alloc_action(sizeof(action_##name), (action_fp) func_##name)
 
-- 
1.7.10.4

