[libvirt] one more warning

Daniel Veillard veillard at redhat.com
Tue Nov 4 13:11:41 UTC 2008


On Mon, Oct 27, 2008 at 07:49:17PM +0100, Jim Meyering wrote:
> One more warning question:
> Compiling with all storage backends disabled, I get this:
> 
> storage_backend.c:91: warning: comparison of unsigned expression < 0 is always false
> 
[...]
> The above loses because ARRAY_CARDINALITY(backends) is 0.
> 
[...]
> Another way is to add a NULL pointer at the end
> and change the loop not to use the array size at all:
> 
>     for (i = 0; backends[i]; i++)
>         if (backends[i]->type == type)
>             return backends[i];
> 
> I chose the latter:

  yup, sounds better to me too,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list