[Libvir] Virtual networking (not the rathole thread :-)
Karel Zak
kzak at redhat.com
Mon Jan 29 09:51:14 UTC 2007
On Mon, Jan 29, 2007 at 09:19:29AM +0000, Richard W.M. Jones wrote:
> Karel Zak wrote:
> >>+ return strdup(tapfdstr);
> > ^^^^^^^^^^^^^^^^^^^
> > where is allocation check?
>
> There's a strong argument that you shouldn't check for out of memory
> errors on small heap allocations. After all, in a typical C program
> there's a ratio somewhere around 10 : 1 of stack objects allocated :
> objects allocated on the heap (malloc, strdup). Yet stack object
> allocation is almost never checked for failures. So you're making your
> code considerably longer and harder to understand in order to catch
> failures in only 1 in 10 memory allocations.
The more important is consistency of the coding style. We check
strdup() results in the library.
Karel
--
Karel Zak <kzak at redhat.com>
More information about the libvir-list
mailing list