mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-31 14:23:53 -06:00
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>
This commit is contained in:
parent
14015304b6
commit
7267c0947d
357 changed files with 1672 additions and 1674 deletions
10
qstring.c
10
qstring.c
|
@ -40,12 +40,12 @@ QString *qstring_from_substr(const char *str, int start, int end)
|
|||
{
|
||||
QString *qstring;
|
||||
|
||||
qstring = qemu_malloc(sizeof(*qstring));
|
||||
qstring = g_malloc(sizeof(*qstring));
|
||||
|
||||
qstring->length = end - start + 1;
|
||||
qstring->capacity = qstring->length;
|
||||
|
||||
qstring->string = qemu_malloc(qstring->capacity + 1);
|
||||
qstring->string = g_malloc(qstring->capacity + 1);
|
||||
memcpy(qstring->string, str + start, qstring->length);
|
||||
qstring->string[qstring->length] = 0;
|
||||
|
||||
|
@ -70,7 +70,7 @@ static void capacity_increase(QString *qstring, size_t len)
|
|||
qstring->capacity += len;
|
||||
qstring->capacity *= 2; /* use exponential growth */
|
||||
|
||||
qstring->string = qemu_realloc(qstring->string, qstring->capacity + 1);
|
||||
qstring->string = g_realloc(qstring->string, qstring->capacity + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,6 +136,6 @@ static void qstring_destroy_obj(QObject *obj)
|
|||
|
||||
assert(obj != NULL);
|
||||
qs = qobject_to_qstring(obj);
|
||||
qemu_free(qs->string);
|
||||
qemu_free(qs);
|
||||
g_free(qs->string);
|
||||
g_free(qs);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue