[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: [Libvir] Virtual networking (not the rathole thread :-)
- From: Karel Zak <kzak redhat com>
- To: "Richard W.M. Jones" <rjones redhat com>
- Cc: libvir-list redhat com
- Subject: Re: [Libvir] Virtual networking (not the rathole thread :-)
- Date: Mon, 29 Jan 2007 10:51:14 +0100
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 redhat com>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]