libctf: don't lose track of all valid types upon serialization
One pattern which is rarely done in libctf but which is meant to work is
this:
ctf_create();
ctf_add_*(); // add stuff
ctf_type_*() // look stuff up
ctf_write_*();
ctf_add_*(); // should still work
ctf_type_*() // so should this
ctf_write_*(); // and this
i.e., writing out a dict should not break it and you should be able to
do everything you could do with it before, including writing it out
again.
Unfortunately this has been broken for a while because the field which
indicates the maximum valid type ID was not preserved across
serialization: so type additions after serialization would overwrite
types (obviously disastrous) and type lookups would just fail.
Fix trivial.
libctf/ChangeLog
2021-03-18 Nick Alcock <nick.alcock@oracle.com>
* ctf-serialize.c (ctf_serialize): Preserve ctf_typemax across
serialization.