|
From: | Ian Molton |
Subject: | Re: [Qemu-devel] [PATCH] Permit zero-sized qemu_malloc() & friends |
Date: | Sun, 06 Dec 2009 16:52:35 +0000 |
User-agent: | Mozilla-Thunderbird 2.0.0.22 (X11/20090707) |
Markus Armbruster wrote: > p = malloc(n * sizeof(struct foo); > if (n && !p) > exit_no_mem(); > for (i = 0; i < n; i++) > compute_one(p, i); > > With qemu_malloc(), the error handling moves into qemu_malloc(): > > p = qemu_malloc(n * sizeof(struct foo); > for (i = 0; i < n; i++) > compute_one(p, i); And you lose the ability to fail gracefully...
[Prev in Thread] | Current Thread | [Next in Thread] |