From: otto Date: Tue, 12 Dec 2017 19:07:10 +0000 (+0000) Subject: Minor cleanup from kshe X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=02ce9935b8a4d664da400df46642a45bd7a578bd;p=openbsd Minor cleanup from kshe --- diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c index 7dea121c9ed..eea7346c1bc 100644 --- a/usr.bin/dc/bcode.c +++ b/usr.bin/dc/bcode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcode.c,v 1.60 2017/12/12 18:58:59 otto Exp $ */ +/* $OpenBSD: bcode.c,v 1.61 2017/12/12 19:07:10 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek @@ -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); @@ -1185,13 +1181,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 { @@ -1495,7 +1490,6 @@ compare(enum bcode_compare type) } } - static void nop(void) {