summaryrefslogtreecommitdiffstats
path: root/qobject
diff options
context:
space:
mode:
authorMarkus Armbruster2020-12-11 18:11:38 +0100
committerMarkus Armbruster2020-12-19 10:38:43 +0100
commit88e25b1e6d8a0e3672ba8d5bae5c1df768c35bc8 (patch)
tree1bf0dce562f75f31b80ae95d1173ee4b8574166b /qobject
parentqobject: Change qobject_to_json()'s value to GString (diff)
downloadqemu-88e25b1e6d8a0e3672ba8d5bae5c1df768c35bc8.tar.gz
qemu-88e25b1e6d8a0e3672ba8d5bae5c1df768c35bc8.tar.xz
qemu-88e25b1e6d8a0e3672ba8d5bae5c1df768c35bc8.zip
Revert "qstring: add qstring_free()"
This reverts commit 164c374b75f87c6765a705c4418ab7005a2d356f. A free function for a reference-counted object is in bad taste. Fortunately, this one is now also unused. Drop it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20201211171152.146877-7-armbru@redhat.com>
Diffstat (limited to 'qobject')
-rw-r--r--qobject/qstring.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/qobject/qstring.c b/qobject/qstring.c
index af7c18ca73..c1891beda0 100644
--- a/qobject/qstring.c
+++ b/qobject/qstring.c
@@ -169,32 +169,15 @@ bool qstring_is_equal(const QObject *x, const QObject *y)
}
/**
- * qstring_free(): Free the memory allocated by a QString object
- *
- * Return: if @return_str, return the underlying string, to be
- * g_free(), otherwise NULL is returned.
- */
-char *qstring_free(QString *qstring, bool return_str)
-{
- char *rv = NULL;
-
- if (return_str) {
- rv = qstring->string;
- } else {
- g_free(qstring->string);
- }
-
- g_free(qstring);
-
- return rv;
-}
-
-/**
* qstring_destroy_obj(): Free all memory allocated by a QString
* object
*/
void qstring_destroy_obj(QObject *obj)
{
+ QString *qs;
+
assert(obj != NULL);
- qstring_free(qobject_to(QString, obj), FALSE);
+ qs = qobject_to(QString, obj);
+ g_free(qs->string);
+ g_free(qs);
}