[Libvir] Patch: Fix documentation and code of virGetDomain function
Jim Meyering
jim at meyering.net
Thu Mar 1 16:55:15 UTC 2007
Mark McLoughlin <markmc at redhat.com> wrote:
> On Wed, 2007-02-28 at 16:24 +0000, Richard W.M. Jones wrote:
>> virGetDomain(virConnectPtr conn, const char *name, const unsigned char *uuid) {
>> virDomainPtr ret = NULL;
>>
>> - if ((!VIR_IS_CONNECT(conn)) || ((name == NULL) && (uuid == NULL)) ||
>> + if ((!VIR_IS_CONNECT(conn)) || (name == NULL) || (uuid == NULL) ||
>
> Need the same fix in virGetNetwork()
>
> (And DV obviously has a parenthesis fetish ... I don't know what's
> wrong with:
>
> if (!VIR_IS_CONNECT(conn) || !name || !uuid || !conn->hashes->mux)
>
> :-)
Heh :-)
Though using 'uuid == NULL' can be seen as more readable than "!uuid"
in that it tells the reader "uuid" is not an integer.
In Coreutils, I use this rule to keep at least one class of useless
parens at bay:
# Avoid useless parentheses like those in this example:
# #if defined (SYMBOL) || defined (SYM2)
sc_useless_cpp_parens:
@grep -n '^# *if .*defined *(' $$($(CVS_LIST_EXCEPT)) && \
{ echo '$(ME): found useless parentheses in cpp directive' \
1>&2; exit 1; } || :
More information about the libvir-list
mailing list