diff mbox series

util/error: Remove an unnecessary NULL check

Message ID 20181207161447.31314-1-philmd@redhat.com (mailing list archive)
State New, archived
Headers show
Series util/error: Remove an unnecessary NULL check | expand

Commit Message

Philippe Mathieu-Daudé Dec. 7, 2018, 4:14 p.m. UTC
This NULL check was required while introduced in 680d16dcb79f.
Later refactor added a NULL check in error_setv(), so this check
is now redundant.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 util/error.c | 4 ----
 1 file changed, 4 deletions(-)

Comments

Daniel P. Berrangé Dec. 7, 2018, 4:22 p.m. UTC | #1
On Fri, Dec 07, 2018 at 05:14:47PM +0100, Philippe Mathieu-Daudé wrote:
> This NULL check was required while introduced in 680d16dcb79f.
> Later refactor added a NULL check in error_setv(), so this check
> is now redundant.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  util/error.c | 4 ----
>  1 file changed, 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
Markus Armbruster Dec. 7, 2018, 6:01 p.m. UTC | #2
Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> This NULL check was required while introduced in 680d16dcb79f.
> Later refactor added a NULL check in error_setv(), so this check
> is now redundant.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Thomas Huth Dec. 7, 2018, 6:16 p.m. UTC | #3
On 2018-12-07 17:14, Philippe Mathieu-Daudé wrote:
> This NULL check was required while introduced in 680d16dcb79f.
> Later refactor added a NULL check in error_setv(), so this check
> is now redundant.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  util/error.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/util/error.c b/util/error.c
> index b5ccbd8eac..934a78e1b1 100644
> --- a/util/error.c
> +++ b/util/error.c
> @@ -103,10 +103,6 @@ void error_setg_errno_internal(Error **errp,
>      va_list ap;
>      int saved_errno = errno;

Could the saved_errno now be removed, too, since err_setv does that again?

 Thomas


> -    if (errp == NULL) {
> -        return;
> -    }
> -
>      va_start(ap, fmt);
>      error_setv(errp, src, line, func, ERROR_CLASS_GENERIC_ERROR, fmt, ap,
>                 os_errno != 0 ? strerror(os_errno) : NULL);
>
Philippe Mathieu-Daudé Dec. 7, 2018, 7:10 p.m. UTC | #4
On 12/7/18 7:16 PM, Thomas Huth wrote:
> On 2018-12-07 17:14, Philippe Mathieu-Daudé wrote:
>> This NULL check was required while introduced in 680d16dcb79f.
>> Later refactor added a NULL check in error_setv(), so this check
>> is now redundant.
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> ---
>>  util/error.c | 4 ----
>>  1 file changed, 4 deletions(-)
>>
>> diff --git a/util/error.c b/util/error.c
>> index b5ccbd8eac..934a78e1b1 100644
>> --- a/util/error.c
>> +++ b/util/error.c
>> @@ -103,10 +103,6 @@ void error_setg_errno_internal(Error **errp,
>>      va_list ap;
>>      int saved_errno = errno;
> 
> Could the saved_errno now be removed, too, since err_setv does that again?

Yes, good idea, I'll send another patch.

> 
>  Thomas
> 
> 
>> -    if (errp == NULL) {
>> -        return;
>> -    }
>> -
>>      va_start(ap, fmt);
>>      error_setv(errp, src, line, func, ERROR_CLASS_GENERIC_ERROR, fmt, ap,
>>                 os_errno != 0 ? strerror(os_errno) : NULL);
>>
> 
>
diff mbox series

Patch

diff --git a/util/error.c b/util/error.c
index b5ccbd8eac..934a78e1b1 100644
--- a/util/error.c
+++ b/util/error.c
@@ -103,10 +103,6 @@  void error_setg_errno_internal(Error **errp,
     va_list ap;
     int saved_errno = errno;
 
-    if (errp == NULL) {
-        return;
-    }
-
     va_start(ap, fmt);
     error_setv(errp, src, line, func, ERROR_CLASS_GENERIC_ERROR, fmt, ap,
                os_errno != 0 ? strerror(os_errno) : NULL);