From: "Emilio G. Cota" <cota@braap.org>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>,
Peter Maydell <peter.maydell@linaro.org>,
Changlong Xie <xiecl.fnst@cn.fujitsu.com>
Subject: [Qemu-devel] [PATCH 2/3] qdist: use g_realloc_n instead of g_realloc
Date: Mon, 25 Jul 2016 11:03:44 -0400 [thread overview]
Message-ID: <1469459025-23606-3-git-send-email-cota@braap.org> (raw)
In-Reply-To: <1469459025-23606-1-git-send-email-cota@braap.org>
While at it, remove the unnecessary parentheses around dist->size.
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
util/qdist.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/util/qdist.c b/util/qdist.c
index eb2236c..cc31140 100644
--- a/util/qdist.c
+++ b/util/qdist.c
@@ -62,8 +62,8 @@ void qdist_add(struct qdist *dist, double x, long count)
if (unlikely(dist->n == dist->size)) {
dist->size *= 2;
- dist->entries = g_realloc(dist->entries,
- sizeof(*dist->entries) * (dist->size));
+ dist->entries = g_realloc_n(dist->entries, dist->size,
+ sizeof(*dist->entries));
}
dist->n++;
entry = &dist->entries[dist->n - 1];
--
2.5.0
next prev parent reply other threads:[~2016-07-25 15:04 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 15:03 [Qemu-devel] [PATCH 0/3] qdist fixes Emilio G. Cota
2016-07-25 15:03 ` [Qemu-devel] [PATCH 1/3] qdist: fix memory leak during binning Emilio G. Cota
2016-07-26 8:42 ` Marc-André Lureau
2016-07-25 15:03 ` Emilio G. Cota [this message]
2016-07-26 8:48 ` [Qemu-devel] [PATCH 2/3] qdist: use g_realloc_n instead of g_realloc Marc-André Lureau
2016-07-25 15:03 ` [Qemu-devel] [PATCH 3/3] qdist: return "(empty)" instead of NULL when printing an empty dist Emilio G. Cota
2016-08-01 8:11 ` [Qemu-devel] [PATCH 0/3] qdist fixes Paolo Bonzini
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=1469459025-23606-3-git-send-email-cota@braap.org \
--to=cota@braap.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=xiecl.fnst@cn.fujitsu.com \
/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).