Hi,
This patch includes the following minor changes:
1. Remove the `__inline' markers from functions that are only called
from the jump table (I would actually like to remove them all as they
are both ugly and utterly useless, but that would yield a much larger
diff).
2. Make bexp() slightly more readable and do not try to normalize() a
number whose scale is already zero.
3. Fix indentation of a brace in set_scale().
4. Always put the `else' keyword on the same line as the preceding
closing brace.
5. Delete excess empty lines.
Index: bcode.c
===================================================================
RCS file: /cvs/src/usr.bin/dc/bcode.c,v
retrieving revision 1.59
diff -u -p -r1.59 bcode.c
--- bcode.c 5 Dec 2017 14:05:22 -0000 1.59
+++ bcode.c 7 Dec 2017 04:31:38 -0000
@@ -66,13 +66,13 @@ static __inline void push(struct value *
static __inline struct value *tos(void);
static __inline struct number *pop_number(void);
static __inline char *pop_string(void);
-static __inline void clear_stack(void);
-static __inline void print_tos(void);
+static void clear_stack(void);
+static void print_tos(void);
static void print_err(void);
static void pop_print(void);
static void pop_printn(void);
-static __inline void print_stack(void);
-static __inline void dup(void);
+static void print_stack(void);
+static void dup(void);
static void swap(void);
static void drop(void);
@@ -477,27 +477,26 @@ pop_string(void)
return stack_popstring(&bmachine.stack);
}
-static __inline void
+static void
clear_stack(void)
{
stack_clear(&bmachine.stack);
}
-static __inline void
+static void
print_stack(void)
{
stack_print(stdout, &bmachine.stack, "", bmachine.obase);
}
-static __inline void
+static void
print_tos(void)
{
struct value *value = tos();
if (value != NULL) {
print_value(stdout, value, "", bmachine.obase);
(void)putchar('\n');
- }
- else
+ } else
warnx("stack empty");
}
@@ -508,8 +507,7 @@ print_err(void)
if (value != NULL) {
print_value(stderr, value, "", bmachine.obase);
(void)putc('\n', stderr);
- }
- else
+ } else
warnx("stack empty");
}
@@ -548,7 +546,7 @@ pop_printn(void)
}
}
-static __inline void
+static void
dup(void)
{
stack_dup(&bmachine.stack);
@@ -594,7 +592,7 @@ set_scale(void)
bmachine.scale = (u_int)scale;
else
warnx("scale too large");
- }
+ }
free_number(n);
}
}
@@ -673,7 +671,6 @@ push_scale(void)
u_int scale = 0;
struct number *n;
-
value = pop();
if (value != NULL) {
switch (value->type) {
@@ -920,8 +917,7 @@ load_array(void)
n = new_number();
bn_check(BN_set_word(n->number, 0));
push_number(n);
- }
- else
+ } else
push(stack_dup_value(v, ©));
}
free_number(inumber);
@@ -1198,13 +1185,12 @@ bexp(void)
warnx("Runtime warning: non-zero fractional part in
exponent");
BN_free(i);
BN_free(f);
- }
- normalize(p, 0);
+ normalize(p, 0);
+ }
- neg = false;
- if (BN_is_negative(p->number)) {
- neg = true;
+ neg = BN_is_negative(p->number);
+ if (neg) {
negate(p);
rscale = bmachine.scale;
} else {
@@ -1507,7 +1493,6 @@ compare(enum bcode_compare type)
}
}
}
-
static void
nop(void)
Regards,
kshe