#include "qemu-common.h"
#include "error.h"
+#include "qjson.h"
+#include "qdict.h"
#include "error_int.h"
-#include "qemu-objects.h"
#include "qerror.h"
struct Error
return;
}
- err = qemu_mallocz(sizeof(*err));
+ err = g_malloc0(sizeof(*err));
va_start(ap, fmt);
err->obj = qobject_to_qdict(qobject_from_jsonv(fmt, &ap));
if (err->msg == NULL) {
QString *str;
str = qerror_format(err->fmt, err->obj);
- err->msg = qemu_strdup(qstring_get_str(str));
+ err->msg = g_strdup(qstring_get_str(str));
QDECREF(str);
}
{
if (err) {
QDECREF(err->obj);
- qemu_free(err->msg);
- qemu_free(err);
+ g_free(err->msg);
+ g_free(err);
}
}
char *ptr;
char *end;
+ if (!err) {
+ return false;
+ }
+
ptr = strstr(fmt, "'class': '");
assert(ptr != NULL);
ptr += strlen("'class': '");
if (errp == NULL) {
return;
}
- err = qemu_mallocz(sizeof(*err));
+ err = g_malloc0(sizeof(*err));
err->obj = qobject_to_qdict(obj);
qobject_incref(obj);