mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 23:35:33 +00:00
dd77730d49
We would like to use a same QObject type to represent numbers, whether they are int, uint, or floats. Getters will allow some compatibility between the various types if the number fits other representations. Add a few more tests while at it. Backports commit 01b2ffcedd94ad7b42bc870e4c6936c87ad03429 from qemu
32 lines
773 B
C
32 lines
773 B
C
/*
|
|
* QObject
|
|
*
|
|
* Copyright (C) 2015 Red Hat, Inc.
|
|
*
|
|
* This work is licensed under the terms of the GNU LGPL, version 2.1
|
|
* or later. See the COPYING.LIB file in the top-level directory.
|
|
*/
|
|
|
|
#include "qemu-common.h"
|
|
#include "qapi/qmp/qbool.h"
|
|
#include "qapi/qmp/qdict.h"
|
|
#include "qapi/qmp/qlist.h"
|
|
#include "qapi/qmp/qstring.h"
|
|
|
|
static void (*qdestroy[QTYPE__MAX])(QObject *) = {
|
|
NULL, /* No such object exists */
|
|
NULL, /* qnull_ is indestructible */
|
|
qnum_destroy_obj,
|
|
qstring_destroy_obj,
|
|
qdict_destroy_obj,
|
|
qlist_destroy_obj,
|
|
qbool_destroy_obj,
|
|
};
|
|
|
|
void qobject_destroy(QObject *obj)
|
|
{
|
|
assert(!obj->refcnt);
|
|
assert(QTYPE_QNULL < obj->type && obj->type < QTYPE__MAX);
|
|
qdestroy[obj->type](obj);
|
|
}
|