Re: [PATCH] src: Avoid needless checks before calling g_strdup()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Monday in 2023, Michal Privoznik wrote:
There are few places where the following pattern occurs:

 if (var)
     other = g_strdup(var);

where @other wasn't initialized before g_strdup(). Checking for
var != NULL is useless in this case, as that's exactly what
g_strdup() does (in which case it returns NULL).

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
src/conf/domain_event.c      | 3 +--
src/libxl/libxl_conf.c       | 6 ++----
src/lxc/lxc_native.c         | 3 +--
src/qemu/qemu_monitor_json.c | 3 +--
src/util/virconf.c           | 3 +--
5 files changed, 6 insertions(+), 12 deletions(-)


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux