diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-20 22:09:37 -0500 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-08-20 23:01:08 -0500 |
commit | 7267c0947d7e8ae5dff7bafd932c3bc285f43e5c (patch) | |
tree | 9aa05d6e05ed83e67bf014f6745a3081b8407dc5 /qapi | |
parent | 14015304b662e8f8ccce46c5a6927af6a14c510b (diff) |
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'qapi')
-rw-r--r-- | qapi/qapi-dealloc-visitor.c | 14 | ||||
-rw-r--r-- | qapi/qmp-input-visitor.c | 12 | ||||
-rw-r--r-- | qapi/qmp-output-visitor.c | 10 | ||||
-rw-r--r-- | qapi/qmp-registry.c | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c index 8cde4dd0d4..f6290611fe 100644 --- a/qapi/qapi-dealloc-visitor.c +++ b/qapi/qapi-dealloc-visitor.c @@ -35,7 +35,7 @@ static QapiDeallocVisitor *to_qov(Visitor *v) static void qapi_dealloc_push(QapiDeallocVisitor *qov, void *value) { - StackEntry *e = qemu_mallocz(sizeof(*e)); + StackEntry *e = g_malloc0(sizeof(*e)); e->value = value; QTAILQ_INSERT_HEAD(&qov->stack, e, node); @@ -47,7 +47,7 @@ static void *qapi_dealloc_pop(QapiDeallocVisitor *qov) QObject *value; QTAILQ_REMOVE(&qov->stack, e, node); value = e->value; - qemu_free(e); + g_free(e); return value; } @@ -64,7 +64,7 @@ static void qapi_dealloc_end_struct(Visitor *v, Error **errp) QapiDeallocVisitor *qov = to_qov(v); void **obj = qapi_dealloc_pop(qov); if (obj) { - qemu_free(*obj); + g_free(*obj); } } @@ -76,7 +76,7 @@ static GenericList *qapi_dealloc_next_list(Visitor *v, GenericList **list, Error **errp) { GenericList *retval = *list; - qemu_free(retval->value); + g_free(retval->value); *list = retval->next; return retval; } @@ -89,7 +89,7 @@ static void qapi_dealloc_type_str(Visitor *v, char **obj, const char *name, Error **errp) { if (obj) { - qemu_free(*obj); + g_free(*obj); } } @@ -121,14 +121,14 @@ Visitor *qapi_dealloc_get_visitor(QapiDeallocVisitor *v) void qapi_dealloc_visitor_cleanup(QapiDeallocVisitor *v) { - qemu_free(v); + g_free(v); } QapiDeallocVisitor *qapi_dealloc_visitor_new(void) { QapiDeallocVisitor *v; - v = qemu_mallocz(sizeof(*v)); + v = g_malloc0(sizeof(*v)); v->visitor.start_struct = qapi_dealloc_start_struct; v->visitor.end_struct = qapi_dealloc_end_struct; diff --git a/qapi/qmp-input-visitor.c b/qapi/qmp-input-visitor.c index 6a1adc9fce..fcf8bf920b 100644 --- a/qapi/qmp-input-visitor.c +++ b/qapi/qmp-input-visitor.c @@ -99,7 +99,7 @@ static void qmp_input_start_struct(Visitor *v, void **obj, const char *kind, } if (obj) { - *obj = qemu_mallocz(size); + *obj = g_malloc0(size); } } @@ -135,11 +135,11 @@ static GenericList *qmp_input_next_list(Visitor *v, GenericList **list, return NULL; } - entry = qemu_mallocz(sizeof(*entry)); + entry = g_malloc0(sizeof(*entry)); if (*list) { so->entry = qlist_next(so->entry); if (so->entry == NULL) { - qemu_free(entry); + g_free(entry); return NULL; } (*list)->next = entry; @@ -199,7 +199,7 @@ static void qmp_input_type_str(Visitor *v, char **obj, const char *name, return; } - *obj = qemu_strdup(qstring_get_str(qobject_to_qstring(qobj))); + *obj = g_strdup(qstring_get_str(qobject_to_qstring(qobj))); } static void qmp_input_type_number(Visitor *v, double *obj, const char *name, @@ -272,14 +272,14 @@ Visitor *qmp_input_get_visitor(QmpInputVisitor *v) void qmp_input_visitor_cleanup(QmpInputVisitor *v) { qobject_decref(v->obj); - qemu_free(v); + g_free(v); } QmpInputVisitor *qmp_input_visitor_new(QObject *obj) { QmpInputVisitor *v; - v = qemu_mallocz(sizeof(*v)); + v = g_malloc0(sizeof(*v)); v->visitor.start_struct = qmp_input_start_struct; v->visitor.end_struct = qmp_input_end_struct; diff --git a/qapi/qmp-output-visitor.c b/qapi/qmp-output-visitor.c index c398cac4f0..4419a31644 100644 --- a/qapi/qmp-output-visitor.c +++ b/qapi/qmp-output-visitor.c @@ -42,7 +42,7 @@ static QmpOutputVisitor *to_qov(Visitor *v) static void qmp_output_push_obj(QmpOutputVisitor *qov, QObject *value) { - QStackEntry *e = qemu_mallocz(sizeof(*e)); + QStackEntry *e = g_malloc0(sizeof(*e)); e->value = value; QTAILQ_INSERT_HEAD(&qov->stack, e, node); @@ -54,7 +54,7 @@ static QObject *qmp_output_pop(QmpOutputVisitor *qov) QObject *value; QTAILQ_REMOVE(&qov->stack, e, node); value = e->value; - qemu_free(e); + g_free(e); return value; } @@ -210,17 +210,17 @@ void qmp_output_visitor_cleanup(QmpOutputVisitor *v) if (e->value) { qobject_decref(e->value); } - qemu_free(e); + g_free(e); } - qemu_free(v); + g_free(v); } QmpOutputVisitor *qmp_output_visitor_new(void) { QmpOutputVisitor *v; - v = qemu_mallocz(sizeof(*v)); + v = g_malloc0(sizeof(*v)); v->visitor.start_struct = qmp_output_start_struct; v->visitor.end_struct = qmp_output_end_struct; diff --git a/qapi/qmp-registry.c b/qapi/qmp-registry.c index 3fe8866d44..5ff99cff14 100644 --- a/qapi/qmp-registry.c +++ b/qapi/qmp-registry.c @@ -19,7 +19,7 @@ static QTAILQ_HEAD(, QmpCommand) qmp_commands = void qmp_register_command(const char *name, QmpCommandFunc *fn) { - QmpCommand *cmd = qemu_mallocz(sizeof(*cmd)); + QmpCommand *cmd = g_malloc0(sizeof(*cmd)); cmd->name = name; cmd->type = QCT_NORMAL; |