was hard to type and hard to fix, galloc is also hard to fix, and some
things I learned will probably improve things more but make me use the
original form as base (especially for space savings)
* let sizeofN die though, remove even more casts
* optimise, polish
* regen Makefiles
* sprinkle a few /* CONSTCOND */ while here
* syn.c: fix bashiop-4 regression test; failed due to me using a
simple string when a wdstring was expected, sorry; the new code
assumes file descriptors take up a maximum of two characters
encountered. However, when reading end of input, the source type is set
to SEOF while popping, whereas the recursion check code only checks for
an SALIAS type.
Fix: add a new SF_HASALIAS flag; change u.tblp from being valid if type
is SALIAS to being valid if SF_HASALIAS is set; set SF_HASALIAS for the
created SALIAS sources; set SF_HASALIAS and u.tblp when creating SALIAS
whose next is SEOF on the SEOF source as well.
Reported by Michael Hlavinka as Redhat Bug #474115
we still have issues:
(gdb) r
Starting program: /usr/obj/bin/mksh/mksh -c print\ \$KSH_VERSION
mksh in free(): error: modified (chunk-) pointer
Program received signal SIGABRT, Aborted.
example:
#define AALLOC_THREAD_ENTER(ap) @synchronized(aalloc_guard) {
#define AALLOC_THREAD_LEAVE(ap) }
notes:
• you must declare and define eventual guard objects yourself
• while there will not be any direct “return” calls inside the
locked area, AALLOC_ABORT and AALLOC_WARN may be called
• AALLOC_RANDOM does not need to be thread-safe, but malloc
and free should be; if “ap” is used for locking, all functions
called must be thread-safe though
allocator using malloc and free, with mmap malloc and omalloc in mind,
not counterfeiting its security measures such as guard pages, and having
some of our own, e.g. XOR random cookies, optional mprotect, etc.
zero cost (for we have arc4random())