[PATCH] lib: Don't check for retval for virCommandNew*()

Laine Stump laine at redhat.com
Tue Aug 23 14:05:35 UTC 2022


On 8/23/22 9:51 AM, Michal Privoznik wrote:
> The virCommand module is specifically designed so that no caller
> has to check for retval of individual virCommand*() APIs except
> for virCommandRun() where the actual error is reported. Moreover,
> virCommandNew*() use g_new0() to allocate memory and thus it's
> not really possible for those APIs to return NULL. Which is why
> they are even marked as ATTRIBUTE_NONNULL. But there are few
> places where we do check the retval which is a dead code
> effectively. Drop those checks.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>

Reviewed-by: Laine Stump <laine at redhat.com>



More information about the libvir-list mailing list