I've noticed some segfaults and sigbus errors on archlinux x86_64 (they don't
ship the readline version) with calc. As it turns out there are some
bugs (overlapping pointers to memcpy) in the internal history
The attached patch replaces the implementation with a doubly linked list.
This requires a bit more memory but is much more flexible, readable and
The patch does not modify HIST_SIZE in hist.h. This define now specifies
the max number of history entries. I didn't know what a good value could
Please let me know if I made any mistakes or didn't provide the patch in
the needed format.