static void qapi_dealloc_push(QapiDeallocVisitor *qov, void *value) { StackEntry *e = g_malloc0(sizeof(*e)); e->value = value; /* see if we're just pushing a list head tracker */ if (value == NULL) { e->is_list_head = true; } QTAILQ_INSERT_HEAD(&qov->stack, e, node); }
static void bus_add_child(BusState *bus, DeviceState *child) { char name[32]; BusChild *kid = g_malloc0(sizeof(*kid)); kid->index = bus->max_index++; kid->child = child; object_ref(OBJECT(kid->child)); QTAILQ_INSERT_HEAD(&bus->children, kid, sibling); /* This transfers ownership of kid->child to the property. */ snprintf(name, sizeof(name), "child[%d]", kid->index); object_property_add_link(OBJECT(bus), name, object_get_typename(OBJECT(child)), (Object **)&kid->child, NULL, /* read-only property */ 0, /* return ownership on prop deletion */ NULL); }