From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: Andrea Arcangeli <aarcange@redhat.com>,
Andre Przywara <andre.przywara@amd.com>,
kvm@vger.kernel.org, Blue Swirl <blauwirbel@gmail.com>,
Bharata B Rao <bharata@linux.vnet.ibm.com>,
Bill Gray <bgray@redhat.com>
Subject: [Qemu-devel] [PATCH 2/6] file_ram_alloc(): use g_strdup_printf() instead of asprintf()
Date: Mon, 2 Jul 2012 15:06:34 -0300 [thread overview]
Message-ID: <1341252398-12268-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1341252398-12268-1-git-send-email-ehabkost@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
exec.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/exec.c b/exec.c
index c8bfd27..d856325 100644
--- a/exec.c
+++ b/exec.c
@@ -24,6 +24,9 @@
#include <sys/mman.h>
#endif
+#include <glib.h>
+#include <glib/gprintf.h>
+
#include "qemu-common.h"
#include "cpu.h"
#include "tcg.h"
@@ -2357,7 +2360,7 @@ static void *file_ram_alloc(RAMBlock *block,
ram_addr_t memory,
const char *path)
{
- char *filename;
+ gchar *filename;
void *area;
int fd;
#ifdef MAP_POPULATE
@@ -2379,18 +2382,15 @@ static void *file_ram_alloc(RAMBlock *block,
return NULL;
}
- if (asprintf(&filename, "%s/qemu_back_mem.XXXXXX", path) == -1) {
- return NULL;
- }
-
+ filename = g_strdup_printf("%s/qemu_back_mem.XXXXXX", path);
fd = mkstemp(filename);
if (fd < 0) {
perror("unable to create backing store for hugepages");
- free(filename);
+ g_free(filename);
return NULL;
}
unlink(filename);
- free(filename);
+ g_free(filename);
memory = (memory + hpagesize - 1) & ~(hpagesize - 1);
--
1.7.10.4
next prev parent reply other threads:[~2012-07-02 18:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-02 18:06 [Qemu-devel] [RFC PATCH 0/6] option to not remove files inside -mem-path dir (v2) Eduardo Habkost
2012-07-02 18:06 ` [Qemu-devel] [PATCH 1/6] file_ram_alloc(): coding style fixes Eduardo Habkost
2012-07-03 19:16 ` Blue Swirl
2012-07-02 18:06 ` Eduardo Habkost [this message]
2012-07-03 19:16 ` [Qemu-devel] [PATCH 2/6] file_ram_alloc(): use g_strdup_printf() instead of asprintf() Blue Swirl
2012-07-02 18:06 ` [Qemu-devel] [PATCH 3/6] vl.c: change mem_prealloc to bool (v2) Eduardo Habkost
2012-07-02 18:06 ` [Qemu-devel] [PATCH 4/6] file_ram_alloc: change length argument to size_t (v2) Eduardo Habkost
2012-07-02 18:06 ` [Qemu-devel] [PATCH 5/6] file_ram_alloc(): extract temporary-file creation code to separate function (v2) Eduardo Habkost
2012-07-02 18:06 ` [Qemu-devel] [RFC PATCH 6/6] add -keep-mem-path-files option (v2) Eduardo Habkost
2012-07-02 18:56 ` [Qemu-devel] [RFC PATCH 0/6] option to not remove files inside -mem-path dir (v2) Daniel P. Berrange
2012-07-02 19:54 ` Eduardo Habkost
2012-07-03 9:03 ` Daniel P. Berrange
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=1341252398-12268-3-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=aarcange@redhat.com \
--cc=andre.przywara@amd.com \
--cc=bgray@redhat.com \
--cc=bharata@linux.vnet.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=kvm@vger.kernel.org \
--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).