dc: execute shouldn't pop if stack head is not a string
authorBrian Foley <bpfoley@google.com>
Thu, 5 Sep 2019 08:46:22 +0000 (10:46 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 21 Oct 2019 14:54:40 +0000 (16:54 +0200)
commit4699b932446f809d747d97f8e24b5d48608f7276
tree5d761ac8e1b891871ddf6d96490e28df541bc945
parent244c0ebb4f71fb9f400d2242bbdeaca0c138c547
dc: execute shouldn't pop if stack head is not a string

This matches the behaviour of both GNU dc (as specified in
its man page), and BSD dc (where stack_popstring() pops
only if the head is a string.)

Add a couple of tests to verify this behavior.

function                                             old     new   delta
zxc_vm_process                                      6882    6884      +2

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/bc.c
testsuite/dc.tests