Discussion:
[Toybox] [PATCH] Update bc to 1.1
Gavin Howard
2018-11-03 16:56:15 UTC
Permalink
Hello,

I am about to release version 1.1 of my bc, so toybox gets a patch. It
is attached.

There are a few notes. First, in order to eliminate a warning, I had
to slightly change the declaration for xstrdup and xstrndup. I have
eliminated memory errors and leaks, as far as Valgrind and ASan can
tell. I also made it faster, by adding a small amount of code to get a
better multiplication algorithm. I also eliminated superfluous code I
had in to help debugging. I also had to add lines of code to fit the
busybox style better (they are getting it too).

Despite all of that, I managed to *reduce* LOC, by 200+ lines, by
using xmalloc and friends.

On top of that, I made the test suite run faster (just over 1 second)
while also making it more comprehensive. At this point, it is still
very minimal, so it should be used just a sanity check. The full test
suite takes 30+ seconds on an optimized bc. Also, if you want the full
test suite while reviewing this code, you can clone my repo at
https://github.com/gavinhoward/bc and then run:

$ $BC_ROOT/tests/all.sh bc $TOYBOX_ROOT/generated/unstripped/toybox bc

If you also want to test the Linux kernel timeconst script, you can run:

$ $BC_ROOT/tests/bc/timeconst.sh ./path/to/timeconst.bc
$TOYBOX_ROOT/generated/unstripped/toybox bc

I would ***highly*** recommend having the full test suite on hand for
review; I have already shrunk the code as much as I can (besides the
ones I added for busybox style), so every line of code has a purpose.

With that said, after testing this thing as hard as I can, I am
supremely confident in it, and I believe that, barring any small bugs,
it is feature-complete and basically finished. Because of that, I am
willing to hand it completely over to toybox and Landley, if he so
desires, although I am willing to support it directly, as well as
share responsibility. I am good with whatever.

Thank you for your patience to this point.

Gavin Howard

Continue reading on narkive:
Loading...