summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko2018-12-11 17:56:09 +0100
committerDenys Vlasenko2018-12-11 17:56:09 +0100
commitc2d15dff42d3f8a805d5437bb5063d3131f800c4 (patch)
tree494e0d7d41cc9ae3e7c95f2e165a5eeb12371d73
parentc355c4a7d620477cc2d7e05b0616976eb2120d17 (diff)
downloadbusybox-c2d15dff42d3f8a805d5437bb5063d3131f800c4.zip
busybox-c2d15dff42d3f8a805d5437bb5063d3131f800c4.tar.gz
bc: move declarations around, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--miscutils/bc.c78
1 files changed, 39 insertions, 39 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c
index 5a4c92a..6fb6c81 100644
--- a/miscutils/bc.c
+++ b/miscutils/bc.c
@@ -221,20 +221,6 @@ typedef struct BcNum {
#define BC_NUM_KARATSUBA_LEN (32)
-typedef void (*BcNumDigitOp)(size_t, size_t, bool) FAST_FUNC;
-
-typedef BcStatus (*BcNumBinaryOp)(BcNum *, BcNum *, BcNum *, size_t) FAST_FUNC;
-
-static BcStatus bc_num_add(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
-static BcStatus bc_num_sub(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
-static BcStatus bc_num_mul(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
-static BcStatus bc_num_div(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
-static BcStatus bc_num_mod(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
-static BcStatus bc_num_pow(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
-static BcStatus bc_num_sqrt(BcNum *a, BcNum *b, size_t scale);
-static BcStatus bc_num_divmod(BcNum *a, BcNum *b, BcNum *c, BcNum *d,
- size_t scale);
-
typedef enum BcInst {
#if ENABLE_BC
@@ -931,6 +917,45 @@ dc_parse_insts[] = {
};
#endif // ENABLE_DC
+// In configurations where errors abort instead of propagating error
+// return code up the call chain, functions returning BC_STATUS
+// actually don't return anything, they always succeed and return "void".
+// A macro wrapper is provided, which makes this statement work:
+// s = zbc_func(...)
+// and makes it visible to the compiler that s is always zero,
+// allowing compiler to optimize dead code after the statement.
+//
+// To make code more readable, each such function has a "z"
+// ("always returning zero") prefix, i.e. zbc_foo or zdc_foo.
+//
+#if ENABLE_FEATURE_BC_SIGNALS || ENABLE_FEATURE_CLEAN_UP
+# define ERRORFUNC /*nothing*/
+# define ERROR_RETURN(a) a
+# define ERRORS_ARE_FATAL 0
+# define BC_STATUS BcStatus
+# define RETURN_STATUS(v) return (v)
+#else
+# define ERRORFUNC NORETURN
+# define ERROR_RETURN(a) /*nothing*/
+# define ERRORS_ARE_FATAL 1
+# define BC_STATUS void
+# define RETURN_STATUS(v) do { ((void)(v)); return; } while (0)
+#endif
+
+typedef void (*BcNumDigitOp)(size_t, size_t, bool) FAST_FUNC;
+
+typedef BcStatus (*BcNumBinaryOp)(BcNum *, BcNum *, BcNum *, size_t) FAST_FUNC;
+
+static BcStatus bc_num_add(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
+static BcStatus bc_num_sub(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
+static BcStatus bc_num_mul(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
+static BcStatus bc_num_div(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
+static BcStatus bc_num_mod(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
+static BcStatus bc_num_pow(BcNum *a, BcNum *b, BcNum *c, size_t scale) FAST_FUNC;
+static BcStatus bc_num_sqrt(BcNum *a, BcNum *b, size_t scale);
+static BcStatus bc_num_divmod(BcNum *a, BcNum *b, BcNum *c, BcNum *d,
+ size_t scale);
+
static const BcNumBinaryOp bc_program_ops[] = {
bc_num_pow, bc_num_mul, bc_num_div, bc_num_mod, bc_num_add, bc_num_sub,
};
@@ -976,31 +1001,6 @@ static void bc_verror_msg(const char *fmt, va_list p)
}
}
-// In configurations where errors abort instead of propagating error
-// return code up the call chain, functions returning BC_STATUS
-// actually don't return anything, they always succeed and return "void".
-// A macro wrapper is provided, which makes this statement work:
-// s = zbc_func(...)
-// and makes it visible to the compiler that s is always zero,
-// allowing compiler to optimize dead code after the statement.
-//
-// To make code more readable, each such function has a "z"
-// ("always returning zero") prefix, i.e. zbc_foo or zdc_foo.
-//
-#if ENABLE_FEATURE_BC_SIGNALS || ENABLE_FEATURE_CLEAN_UP
-# define ERRORFUNC /*nothing*/
-# define ERROR_RETURN(a) a
-# define ERRORS_ARE_FATAL 0
-# define BC_STATUS BcStatus
-# define RETURN_STATUS(v) return (v)
-#else
-# define ERRORFUNC NORETURN
-# define ERROR_RETURN(a) /*nothing*/
-# define ERRORS_ARE_FATAL 1
-# define BC_STATUS void
-# define RETURN_STATUS(v) do { ((void)(v)); return; } while (0)
-#endif
-
static NOINLINE ERRORFUNC int bc_error_fmt(const char *fmt, ...)
{
va_list p;