@@ -247,7 +247,7 @@ static JSONParserContext *parser_context_new(GQueue *tokens)
return NULL;
}
- ctxt = g_malloc0(sizeof(JSONParserContext));
+ ctxt = g_new0(JSONParserContext, 1);
ctxt->buf = tokens;
return ctxt;
@@ -25,7 +25,7 @@ QBool *qbool_from_bool(bool value)
{
QBool *qb;
- qb = g_malloc(sizeof(*qb));
+ qb = g_new(QBool, 1);
qobject_init(QOBJECT(qb), QTYPE_QBOOL);
qb->value = value;
@@ -30,7 +30,7 @@ QDict *qdict_new(void)
{
QDict *qdict;
- qdict = g_malloc0(sizeof(*qdict));
+ qdict = g_new0(QDict, 1);
qobject_init(QOBJECT(qdict), QTYPE_QDICT);
return qdict;
@@ -70,7 +70,7 @@ static QDictEntry *alloc_entry(const char *key, QObject *value)
{
QDictEntry *entry;
- entry = g_malloc0(sizeof(*entry));
+ entry = g_new0(QDictEntry, 1);
entry->key = g_strdup(key);
entry->value = value;
@@ -25,7 +25,7 @@ QList *qlist_new(void)
{
QList *qlist;
- qlist = g_malloc(sizeof(*qlist));
+ qlist = g_new(QList, 1);
qobject_init(QOBJECT(qlist), QTYPE_QLIST);
QTAILQ_INIT(&qlist->head);
@@ -58,7 +58,7 @@ void qlist_append_obj(QList *qlist, QObject *value)
{
QListEntry *entry;
- entry = g_malloc(sizeof(*entry));
+ entry = g_new(QListEntry, 1);
entry->value = value;
QTAILQ_INSERT_TAIL(&qlist->head, entry, next);
@@ -42,7 +42,7 @@ QString *qstring_from_substr(const char *str, int start, int end)
{
QString *qstring;
- qstring = g_malloc(sizeof(*qstring));
+ qstring = g_new(QString, 1);
qobject_init(QOBJECT(qstring), QTYPE_QSTRING);
qstring->length = end - start + 1;
@@ -182,7 +182,7 @@ static void test_visitor_out_struct_nested(TestOutputVisitorData *data,
const char *strings[] = { "forty two", "forty three", "forty four",
"forty five" };
- ud2 = g_malloc0(sizeof(*ud2));
+ ud2 = g_new0(UserDefTwo, 1);
ud2->string0 = g_strdup(strings[0]);
ud2->dict1 = g_malloc0(sizeof(*ud2->dict1));
@@ -372,7 +372,7 @@ static void test_visitor_out_union_flat(TestOutputVisitorData *data,
{
QDict *qdict;
- UserDefFlatUnion *tmp = g_malloc0(sizeof(UserDefFlatUnion));
+ UserDefFlatUnion *tmp = g_new0(UserDefFlatUnion, 1);
tmp->enum1 = ENUM_ONE_VALUE1;
tmp->string = g_strdup("str");
tmp->integer = 41;