In platforms with bounds-checking enabled, placeholder values for array sizes in structs that may be exceeded always result in a sigtrap.
This patch updates the following classes to use flexible arrays at the end of structs:
- database
- Label
- PropertyRecord (union of three flexible arrays and a pointer*)
- cellUE
- extflat
- HierName
- EFAttr
- Dev
- utils
- HashEntry (union of two flexible arrays and a pointer*)
- internalUndoEvent: Was a plain int, replaced with a flexible char array
Additionally, the database struct editUE, which would have just a single flexible-array member, was removed and simply replaced with a character pointer.
Where possible, allocation size macros have been introduced.
---
* It is noted flexible-length arrays as part of unions are not part of the C language spec and are a GNU99 extension, however, it is supported by both GCC and Clang.
This is needed to allow K&R to be removed and struct prototypes to
exist that have fully declared (argument) types.
It maybe necessary (in the future) to have public types and module
internal type in separate header files, but it is unclear if such a
clear split exists.
Copyright plate taken from extflat.h