Make API creation foolproof
sion_generic_create_api
creates an API that is in a completely invalid state and the various sion_generic_register...
functions all register a single callback function, leaving the API again in an invalid state until all necessary callbacks have been registered. Why not have sion_generic_create_api
take all necessary callbacks as an argument and create a valid API descriptor in a single step?
As there seem to be different levels of capability that require fewer or more callbacks to be defined, there could be several create
functions, one per level or, a single create
function that accepts NULL
for optional callbacks and sets the correct capability level.