Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Peter Maydell
On 15 December 2011 10:19, Stefan Hajnoczi wrote: > On Thu, Dec 15, 2011 at 11:02:39AM +0100, Kevin Wolf wrote: >> I think this was related to qemu_malloc() and Anthony's sed run made it >> refer to g_malloc(), even though it works just fine with 0 bytes. We >> should probably remove this sentence

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Kevin Wolf
Am 15.12.2011 11:19, schrieb Stefan Hajnoczi: > On Thu, Dec 15, 2011 at 11:02:39AM +0100, Kevin Wolf wrote: >> Am 15.12.2011 10:36, schrieb Stefan Hajnoczi: >>> On Thu, Dec 15, 2011 at 04:28:28PM +0800, 陳韋任 wrote: I found this in HACKING: Please note that NULL check for the g_mall

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Max Filippov
>> >>  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(). >> >> I think this was related to qemu_ma

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Stefan Hajnoczi
On Thu, Dec 15, 2011 at 11:02:39AM +0100, Kevin Wolf wrote: > Am 15.12.2011 10:36, schrieb Stefan Hajnoczi: > > 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()

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Kevin Wolf
Am 15.12.2011 10:36, schrieb Stefan Hajnoczi: > 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

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread 陳韋任
> Maybe there is insufficient memory, the return is error, > Do we need to check the return ? It'll abort if there is not enough memory. http://mail.gnome.org/archives/gtk-app-devel-list/2003-September/msg00260.html Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of In

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Zhi Hui Li
On 2011年12月15日 17:36, Stefan Hajnoczi wrote: 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

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Stefan Hajnoczi
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 no

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread 陳韋任
Hi, 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. Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Andreas Färber
Am 15.12.2011 09:10, schrieb Zhi Hui Li: > > I am not sure whether it is need to check the return of g_malloc in > qemu ? Compare the glib manual: http://developer.gnome.org/glib/2.30/glib-Memory-Allocation.html#g-malloc http://developer.gnome.org/glib/2.30/glib-Memory-Allocation.html#g-try

Re: [Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread 陳韋任
> I am not sure whether it is need to check the return of g_malloc in > qemu ? I think not, that's why you use g_malloc as a wrapper. Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 H

[Qemu-devel] some questions about g_malloc in qemu

2011-12-15 Thread Zhi Hui Li
I am not sure whether it is need to check the return of g_malloc in qemu ? Thank you very much !