qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: 陳韋任 <chenwj@iis.sinica.edu.tw>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Zhi Hui Li <zhihuili@linux.vnet.ibm.com>,
	zhihuili@cn.ibm.com,
	Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>,
	QEMU-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] some questions about g_malloc in qemu
Date: Thu, 15 Dec 2011 09:36:37 +0000	[thread overview]
Message-ID: <20111215093637.GA387@stefanha-thinkpad.localdomain> (raw)
In-Reply-To: <20111215082828.GA33201@cs.nctu.edu.tw>

On Thu, Dec 15, 2011 at 04:28:28PM +0800, 陳韋任 wrote:
>  I found this in HACKING:
> 
>   Please note that NULL check for the g_malloc result is redundant and
>   that g_malloc() call with zero size is not allowed.

So we have:

1. You should not request 0 bytes from g_malloc().
2. g_malloc() does not return NULL (if you follow rule #1).

There is no need to check for NULL return.

Stefan

  reply	other threads:[~2011-12-15  9:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15  8:10 [Qemu-devel] some questions about g_malloc in qemu Zhi Hui Li
2011-12-15  8:14 ` 陳韋任
2011-12-15  8:19 ` Andreas Färber
2011-12-15  8:28 ` 陳韋任
2011-12-15  9:36   ` Stefan Hajnoczi [this message]
2011-12-15  9:48     ` Zhi Hui Li
2011-12-15  9:56       ` 陳韋任
2011-12-15 10:02     ` Kevin Wolf
2011-12-15 10:19       ` Stefan Hajnoczi
2011-12-15 10:37         ` Max Filippov
2011-12-15 10:44         ` Kevin Wolf
2011-12-15 10:45         ` Peter Maydell

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=20111215093637.GA387@stefanha-thinkpad.localdomain \
    --to=stefanha@gmail.com \
    --cc=chenwj@iis.sinica.edu.tw \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@linux.vnet.ibm.com \
    --cc=zhihuili@cn.ibm.com \
    --cc=zhihuili@linux.vnet.ibm.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).