Commit ID:      1005DF16C840A030F8D
CVSROOT:        /cvs
Module name:    src
Changes by:     t...@herc.mirbsd.org    2019/12/11 22:27:31 UTC

Modified files:
        bin/mksh       : var.c

Log message:
save tons of realloc and free by…

• reusing already allocated variables (and allocating them the max() size
  needed in the first place)
• remembering the size allocated and avoiding shrinking calls to realloc
  (unless a configurable amount is wasted to keep RAM usage sensible) in
  those places where we guess the allocated size already (or with a small
  change)
• use an on-stack buffer for variable names up to 31 bytes

also saves a few afree calls where we know it can’t be nōn-nil

To generate a diff of this changeset, execute the following commands:
cvs -R rdiff -kk -upr1.230 -r1.231 src/bin/mksh/var.c

Reply via email to