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>
Thu, 5 Sep 2019 08:46:22 +0000 (10:46 +0200)
commit7454879a1d9e3948a9af21e31e9d59d5ae8b89f2
treebf127bd4540a12f52ff6af0a0260b7a1f3222149
parent22a633962786a7bc97870ced913fc237143cfd68
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