block: Make bdrv_is_allocated() byte-based
[qemu/ar7.git] / qobject / qobject.c
blobb0cafb66f1bf59e4ec2c96c5180204883ea38d42
1 /*
2 * QObject
4 * Copyright (C) 2015 Red Hat, Inc.
6 * This work is licensed under the terms of the GNU LGPL, version 2.1
7 * or later. See the COPYING.LIB file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "qemu-common.h"
12 #include "qapi/qmp/types.h"
14 static void (*qdestroy[QTYPE__MAX])(QObject *) = {
15 [QTYPE_NONE] = NULL, /* No such object exists */
16 [QTYPE_QNULL] = NULL, /* qnull_ is indestructible */
17 [QTYPE_QNUM] = qnum_destroy_obj,
18 [QTYPE_QSTRING] = qstring_destroy_obj,
19 [QTYPE_QDICT] = qdict_destroy_obj,
20 [QTYPE_QLIST] = qlist_destroy_obj,
21 [QTYPE_QBOOL] = qbool_destroy_obj,
24 void qobject_destroy(QObject *obj)
26 assert(!obj->refcnt);
27 assert(QTYPE_QNULL < obj->type && obj->type < QTYPE__MAX);
28 qdestroy[obj->type](obj);