On 10/08/2017 18:36, Markus Armbruster wrote: >>> + while (!QSIMPLEQ_EMPTY(&oo_queue)) { >>> + ObjectOptionsQueueEntry *e = QSIMPLEQ_FIRST(&oo_queue); >>> + >>> + QSIMPLEQ_REMOVE_HEAD(&oo_queue, entry); >>> + qapi_free_ObjectOptions(e->oo); >>> + g_free(e); >>> + } >> Why not free the queue entry in object_create, and assert here that it's >> empty? > > Assumes object_create_delayed(TYPE) == !object_create_initial(TYPE), > which is the case. Fewer assumptions is good. Less code is also good. > Pick your goodness, please :)
I think the assumption is not that object_create_delayed(TYPE) == !object_create_initial(TYPE), but rather that all -object options are dealt with (and they shouldn't be dealt more than once). It's a reasonable assumption, methinks. :) Paolo