On 03/19/2012 11:32 AM, Daniel P. Berrange wrote:
On Mon, Mar 19, 2012 at 08:51:24AM +0100, Martin Kletzander wrote:
> On 03/19/2012 08:43 AM, Wen Congyang wrote:
>> At 03/18/2012 08:29 AM, Martin Kletzander Wrote:
>>> This patch fixes a NULL pointer check that was causing SegFault on
>>> some specific configurations.
>>> ---
>>> src/util/conf.c | 5 ++++-
>>> 1 files changed, 4 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/src/util/conf.c b/src/util/conf.c
>>> index 8ad60e0..e76362c 100644
>>> --- a/src/util/conf.c
>>> +++ b/src/util/conf.c
>>> @@ -1,7 +1,7 @@
>>> /**
>>> * conf.c: parser for a subset of the Python encoded Xen configuration
files
>>> *
>>> - * Copyright (C) 2006-2011 Red Hat, Inc.
>>> + * Copyright (C) 2006-2012 Red Hat, Inc.
>>> *
>>> * See COPYING.LIB for the License of this software
>>> *
>>> @@ -836,6 +836,9 @@ virConfGetValue(virConfPtr conf, const char *setting)
>>> {
>>> virConfEntryPtr cur;
>>>
>>> + if (conf == NULL)
>>> + return(NULL);
>>
>> Please use 'return NULL;' instead of 'return(NULL);'
>>
>> 'return(NULL);' is old style, and we donot use it now and later.
>>
>
> It seems weird to me too, it's just that it's almost everywhere in this
> file so that's why I wanted to keep the same look.
That is a historical remant. Do feel free to send another followup patch to
cleanup all the cases of 'return(NULL)' as well.
Daniel
Did you mean in that file or globally? Because I just tried the first
thing that came to my mind and look at the output:
libvirt $ find . -name '*.[ch]' -type f -exec grep -nH -e \
'return(.*);' {} + | wc -l
852
Not that I wouldn't do it, it just seem as a pretty big change. On the
other hand, I don't see the point in changing that in only one file.
Martin