Hi,
The diff below encompasses three unrelated minor changes.
1. Merge the not_equal(), not_less() and not_greater() functions into
their caller; these functions cannot be called from the jump table, so
it is confusing to define them as if they could.
2. Make warnings consistent by using warnx(3) everywhere.
3. Add a missing parenthesis in a comment.
Index: bcode.c
===================================================================
RCS file: /cvs/src/usr.bin/dc/bcode.c,v
retrieving revision 1.51
diff -u -p -r1.51 bcode.c
--- bcode.c 26 Feb 2017 11:29:55 -0000 1.51
+++ bcode.c 17 Nov 2017 02:38:12 -0000
@@ -95,18 +95,14 @@ static void bdiv(void);
static void less_numbers(void);
static void lesseq_numbers(void);
static void equal(void);
-static void not_equal(void);
static void less(void);
-static void not_less(void);
static void greater(void);
-static void not_greater(void);
static void not_compare(void);
static bool compare_numbers(enum bcode_compare, struct number *,
struct number *);
@@ -1195,7 +1207,7 @@ bexp(void)
negate(p);
rscale = bmachine.scale;
} else {
- /* Posix bc says min(a.scale * b, max(a.scale, scale) */
+ /* Posix bc says min(a.scale * b, max(a.scale, scale)) */
u_long b;
u_int m;
@@ -1402,12 +1400,6 @@ lesseq_numbers(void)
}
static void
-not_equal(void)
-{
- compare(BCODE_NOT_EQUAL);
-}
-
-static void
less(void)
{
compare(BCODE_LESS);
@@ -1418,39 +1410,27 @@ not_compare(void)
{
switch (readch()) {
case '<':
- not_less();
+ compare(BCODE_NOT_LESS);
break;
case '>':
- not_greater();
+ compare(BCODE_NOT_GREATER);
break;
case '=':
- not_equal();
+ compare(BCODE_NOT_EQUAL);
break;
default:
unreadch();
- (void)fprintf(stderr, "! command is deprecated\n");
+ warnx("! command is deprecated");
break;
}
}
static void
-not_less(void)
-{
- compare(BCODE_NOT_LESS);
-}
-
-static void
greater(void)
{
compare(BCODE_GREATER);
}
-static void
-not_greater(void)
-{
- compare(BCODE_NOT_GREATER);
-}
-
static bool
compare_numbers(enum bcode_compare type, struct number *a, struct number *b)
{
Regards,
kshe