From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 2 of 5] [UPDATE] implementing qemu_reallocz
Date: Fri, 21 Nov 2008 17:07:31 +0000 [thread overview]
Message-ID: <4926EAD3.6020507@eu.citrix.com> (raw)
Adding a qemu_reallocz implementation.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
diff -r aceb9c1e17b1 qemu-common.h
--- a/qemu-common.h Fri Nov 21 12:41:26 2008 +0000
+++ b/qemu-common.h Fri Nov 21 14:36:45 2008 +0000
@@ -96,6 +96,7 @@
void *qemu_malloc(size_t size);
void *qemu_realloc(void *ptr, size_t size);
+void *qemu_reallocz(void *ptr, size_t size);
void *qemu_mallocz(size_t size);
void qemu_free(void *ptr);
char *qemu_strdup(const char *str);
diff -r aceb9c1e17b1 qemu-malloc.c
--- a/qemu-malloc.c Fri Nov 21 12:41:26 2008 +0000
+++ b/qemu-malloc.c Fri Nov 21 14:36:45 2008 +0000
@@ -53,6 +53,16 @@
return ptr;
}
+void *qemu_reallocz(void *ptr, size_t size)
+{
+ void *res;
+ res = realloc(ptr, size);
+ if (!res)
+ return NULL;
+ memset(res, 0, size);
+ return res;
+}
+
char *qemu_strdup(const char *str)
{
char *ptr;
next reply other threads:[~2008-11-21 17:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-21 17:07 Stefano Stabellini [this message]
2008-11-21 18:03 ` [Qemu-devel] [PATCH 2 of 5] [UPDATE] implementing qemu_reallocz Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4926EAD3.6020507@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).