[PATCH 00/13] Use struct zero initializer instead of memset

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

 



This was inspired by Martin's comment here:

https://listman.redhat.com/archives/libvir-list/2023-July/241007.html

It has sent me down a rabbit hole. But hey, it helped me to identify
some needless memset()-s, unused variables, problematic code patterns.

Michal Prívozník (13):
  tools: Fix vshControl declaration and initialization
  virt-aa-helper: Use struct zero initializer instead of memset
  Decrease scope of some variables
  qemu: Don't reuse variable in processSerialChangedEvent()
  remote_driver: Drop explicit memset(&sargs) in remoteAuthSASL()
  virfirewalld: Drop useless memset() in virFirewallDApplyRule()
  virnetlink: Drop unused variable from virNetlinkCommand()
  securityselinuxhelper: Use g_new0() instead of malloc()+memset() combo
  virnetclient: Update comment about memset()
  virnetdaemon.c: Use struct zero initializer instead of memset
  lib: use struct zero initializer instead of memset
  lib: Finish using struct zero initializer manually
  lib: Prefer sizeof(variable) instead of sizeof(type) in memset

 src/ch/ch_monitor.c                    |   3 +-
 src/conf/domain_conf.c                 |   8 +-
 src/conf/network_conf.c                |  28 ++----
 src/cpu/cpu_x86.c                      |   4 +-
 src/esx/esx_driver.c                   |  20 ++---
 src/esx/esx_interface_driver.c         |  13 +--
 src/esx/esx_storage_backend_iscsi.c    |  11 +--
 src/esx/esx_storage_backend_vmfs.c     |  19 ++--
 src/esx/esx_util.c                     |   4 +-
 src/libxl/libxl_capabilities.c         |   4 +-
 src/libxl/libxl_driver.c               |   9 +-
 src/locking/lock_driver_lockd.c        |  19 ++--
 src/logging/log_manager.c              |  25 ++----
 src/lxc/lxc_controller.c               |   6 +-
 src/lxc/lxc_domain.c                   |   4 +-
 src/lxc/lxc_driver.c                   |   4 +-
 src/nwfilter/nwfilter_dhcpsnoop.c      |   4 +-
 src/nwfilter/nwfilter_gentech_driver.c |   4 +-
 src/qemu/qemu_agent.c                  |  10 +--
 src/qemu/qemu_command.c                |   3 +-
 src/qemu/qemu_driver.c                 |  28 +++---
 src/qemu/qemu_monitor.c                |  10 +--
 src/qemu/qemu_monitor_json.c           |  11 +--
 src/qemu/qemu_process.c                |   5 +-
 src/remote/remote_daemon_dispatch.c    | 115 ++++++++-----------------
 src/remote/remote_daemon_stream.c      |  23 ++---
 src/remote/remote_driver.c             |  23 ++---
 src/rpc/virnetclient.c                 |   4 +-
 src/rpc/virnetclientprogram.c          |   4 +-
 src/rpc/virnetclientstream.c           |   9 +-
 src/rpc/virnetdaemon.c                 |  10 +--
 src/rpc/virnetsaslcontext.c            |   3 +-
 src/rpc/virnetserverprogram.c          |  14 +--
 src/rpc/virnetsocket.c                 |  49 +++--------
 src/rpc/virnetsshsession.c             |   8 +-
 src/rpc/virnettlscontext.c             |   3 +-
 src/security/virt-aa-helper.c          |   5 +-
 src/storage/storage_backend_logical.c  |  10 +--
 src/storage/storage_driver.c           |   2 +-
 src/test/test_driver.c                 |   4 +-
 src/util/virarptable.c                 |   3 +-
 src/util/virauth.c                     |   4 +-
 src/util/virbpf.c                      |  52 +++--------
 src/util/virdevmapper.c                |   8 +-
 src/util/virfdstream.c                 |   3 +-
 src/util/virfile.c                     |   3 +-
 src/util/virfirewalld.c                |   2 -
 src/util/virinitctl.c                  |   4 +-
 src/util/viriscsi.c                    |   4 +-
 src/util/virlog.c                      |   9 +-
 src/util/virnetdev.c                   |   8 +-
 src/util/virnetdevbridge.c             |  10 +--
 src/util/virnetdevip.c                 |   8 +-
 src/util/virnetdevmacvlan.c            |   3 +-
 src/util/virnetdevtap.c                |   9 +-
 src/util/virnetlink.c                  |   7 +-
 src/util/virperf.c                     |   3 +-
 src/util/virprocess.c                  |   3 +-
 src/util/virsocket.c                   |   6 +-
 src/util/virsocketaddr.c               |   7 +-
 src/util/viruri.c                      |   4 +-
 src/util/virutil.c                     |   4 +-
 src/util/viruuid.c                     |   4 +-
 src/vbox/vbox_storage.c                |  10 +--
 src/vmx/vmx.c                          |   8 +-
 tests/libxlmock.c                      |   4 +-
 tests/nsstest.c                        |   8 +-
 tests/nwfilterxml2firewalltest.c       |   4 +-
 tests/qemumonitorjsontest.c            |  11 +--
 tests/qemumonitortestutils.c           |   8 +-
 tests/qemuxml2argvtest.c               |   4 +-
 tests/securityselinuxhelper.c          |   5 +-
 tests/sockettest.c                     |   6 +-
 tests/virhostcputest.c                 |   3 +-
 tests/virnetmessagetest.c              |   8 +-
 tests/virnetsockettest.c               |   7 +-
 tools/nss/libvirt_nss.c                |  10 +--
 tools/virsh-domain-monitor.c           |  10 +--
 tools/virsh-domain.c                   |  15 ++--
 tools/virsh.c                          |   7 +-
 tools/virt-admin.c                     |   7 +-
 tools/vsh-table.c                      |   4 +-
 82 files changed, 258 insertions(+), 591 deletions(-)

-- 
2.41.0




[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