On Mon, Feb 25, 2019 at 03:39:14PM +0200, Gabriel Ivăncescu wrote:
Ok, I have a question now: can I use a small helper that uses the cast instead of a union? Something like:
static inline BYTE *get_nodata_items(const LB_DESCR *descr) { return (BYTE*)descr->items; }
And use it where needed? It would require less changes to the code and, IMO, keep it cleaner (other than the one helper above). Such helpers are frequent in other parts of the code (mostly dealing with COM stuff).
No. That's just hiding the hack. The issue is that regular storage and no date storage should have an equal footing. With a union it's clear. The only places you should need to change of the helpers and most of those don't do anything in the no data case, so it shouldn't be too bad.
On a side note, I'll also rewrite FindString since it's a mess and would still be a mess even if I replaced it with the helpers only.
Ok, good.
Huw.