qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Markus Armbruster <armbru@redhat.com>, qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH] qga: Use g_new() & friends where that makes obvious sense
Date: Mon, 14 Sep 2015 09:50:30 -0600	[thread overview]
Message-ID: <55F6ECC6.9080204@redhat.com> (raw)
In-Reply-To: <1442231444-23257-1-git-send-email-armbru@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 999 bytes --]

On 09/14/2015 05:50 AM, Markus Armbruster wrote:
> g_new(T, n) is neater than g_malloc(sizeof(T) * n).  It's also safer,
> for two reasons.  One, it catches multiplication overflowing size_t.
> Two, it returns T * rather than void *, which lets the compiler catch
> more type errors.
> 
> This commit only touches allocations with size arguments of the form
> sizeof(T).  Same Coccinelle semantic patch as in commit b45c03f.
> 
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  qga/channel-posix.c             |  2 +-
>  qga/channel-win32.c             |  2 +-
>  qga/commands-posix.c            | 10 +++++-----
>  qga/commands-win32.c            | 10 +++++-----
>  qga/commands.c                  |  6 +++---
>  qga/guest-agent-command-state.c |  4 ++--
>  6 files changed, 17 insertions(+), 17 deletions(-)

Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2015-09-14 15:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-14 11:50 [Qemu-devel] [PATCH] qga: Use g_new() & friends where that makes obvious sense Markus Armbruster
2015-09-14 15:50 ` Eric Blake [this message]
2015-09-24  7:02 ` Markus Armbruster
2015-09-24 11:02   ` Michael Roth

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=55F6ECC6.9080204@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=mdroth@linux.vnet.ibm.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).