[libvirt] [PATCH 00/75] Drop virAsprintf() in favor of g_strdup_printf()

Michal Privoznik posted 75 patches 4 years, 6 months ago
Test syntax-check passed
Failed in applying to current master (apply log)
build-aux/syntax-check.mk                  |  10 +-
docs/hacking.html.in                       |  13 +-
m4/virt-compile-warnings.m4                |   2 -
src/access/viraccessdriverpolkit.c         |   6 +-
src/bhyve/bhyve_capabilities.c             |   6 +-
src/bhyve/bhyve_process.c                  |  16 +-
src/conf/capabilities.c                    |   3 +-
src/conf/domain_addr.c                     |   8 +-
src/conf/domain_audit.c                    |  60 +++-----
src/conf/domain_conf.c                     |  48 +++---
src/conf/moment_conf.c                     |   5 +-
src/conf/network_conf.c                    |   2 +-
src/conf/node_device_util.c                |   3 +-
src/conf/snapshot_conf.c                   |   5 +-
src/conf/storage_conf.c                    |   6 +-
src/conf/virchrdev.c                       |   7 +-
src/conf/virnetworkobj.c                   |   8 +-
src/conf/virnetworkportdef.c               |   2 +-
src/conf/virnwfilterbindingobj.c           |   2 +-
src/conf/virstorageobj.c                   |   3 +-
src/cpu/cpu_ppc64.c                        |  30 ++--
src/cpu/cpu_x86.c                          |  27 ++--
src/driver.c                               |   6 +-
src/esx/esx_driver.c                       |  54 +++----
src/esx/esx_storage_backend_vmfs.c         |  67 +++-----
src/esx/esx_stream.c                       |  11 +-
src/esx/esx_vi.c                           |  31 ++--
src/hyperv/hyperv_driver.c                 |  11 +-
src/hyperv/hyperv_wmi.c                    |  23 +--
src/interface/interface_backend_netcf.c    |   7 +-
src/interface/interface_backend_udev.c     |  14 +-
src/libvirt-admin.c                        |  12 +-
src/libvirt_private.syms                   |   2 -
src/libxl/libxl_conf.c                     |  34 ++---
src/libxl/libxl_domain.c                   |  34 ++---
src/libxl/libxl_domain.h                   |   2 +-
src/libxl/libxl_driver.c                   |  19 +--
src/libxl/libxl_logger.c                   |  14 +-
src/libxl/libxl_migration.c                |   9 +-
src/libxl/xen_common.c                     |  11 +-
src/libxl/xen_xl.c                         |  18 +--
src/libxl/xen_xm.c                         |   6 +-
src/locking/lock_daemon.c                  |  17 +--
src/locking/lock_daemon_config.c           |   5 +-
src/locking/lock_driver_lockd.c            |   9 +-
src/locking/lock_driver_sanlock.c          |  12 +-
src/locking/lock_manager.c                 |   4 +-
src/logging/log_daemon.c                   |  26 +---
src/logging/log_daemon_config.c            |   5 +-
src/logging/log_manager.c                  |   5 +-
src/lxc/lxc_container.c                    |  68 ++++-----
src/lxc/lxc_controller.c                   |  79 ++++------
src/lxc/lxc_driver.c                       |  15 +-
src/lxc/lxc_fuse.c                         |  10 +-
src/lxc/lxc_monitor.c                      |   4 +-
src/lxc/lxc_native.c                       |  11 +-
src/lxc/lxc_process.c                      |  35 ++---
src/network/bridge_driver.c                |  69 ++++-----
src/network/leaseshelper.c                 |   6 +-
src/node_device/node_device_driver.c       |   3 +-
src/node_device/node_device_hal.c          |   7 +-
src/node_device/node_device_udev.c         |  11 +-
src/nwfilter/nwfilter_dhcpsnoop.c          |  16 +-
src/openvz/openvz_conf.c                   |  18 +--
src/openvz/openvz_driver.c                 |   7 +-
src/phyp/phyp_driver.c                     |  19 +--
src/qemu/qemu_agent.c                      |   9 +-
src/qemu/qemu_alias.c                      | 114 +++++++-------
src/qemu/qemu_block.c                      |  45 +++---
src/qemu/qemu_blockjob.c                   |  12 +-
src/qemu/qemu_capabilities.c               |  14 +-
src/qemu/qemu_checkpoint.c                 |  11 +-
src/qemu/qemu_command.c                    | 113 ++++++--------
src/qemu/qemu_conf.c                       | 141 ++++++-----------
src/qemu/qemu_conf.h                       |   4 +-
src/qemu/qemu_domain.c                     | 168 ++++++++-------------
src/qemu/qemu_domain.h                     |   6 +-
src/qemu/qemu_driver.c                     |   6 +-
src/qemu/qemu_firmware.c                   |   3 +-
src/qemu/qemu_hotplug.c                    |  80 ++++------
src/qemu/qemu_interface.c                  |   5 +-
src/qemu/qemu_interop_config.c             |   9 +-
src/qemu/qemu_migration.c                  |  33 ++--
src/qemu/qemu_migration_cookie.c           |   3 +-
src/qemu/qemu_monitor.c                    |  33 ++--
src/qemu/qemu_monitor_json.c               |  26 +---
src/qemu/qemu_monitor_text.c               |  15 +-
src/qemu/qemu_process.c                    |  74 +++------
src/qemu/qemu_slirp.c                      |  18 +--
src/qemu/qemu_tpm.c                        |  19 +--
src/qemu/qemu_vhost_user_gpu.c             |   3 +-
src/remote/remote_daemon.c                 |  37 ++---
src/remote/remote_daemon_config.c          |   5 +-
src/remote/remote_daemon_dispatch.c        |  20 +--
src/remote/remote_driver.c                 |  20 +--
src/rpc/virnetclient.c                     |  23 +--
src/rpc/virnetlibsshsession.c              |  17 +--
src/rpc/virnetsocket.c                     |   3 +-
src/rpc/virnetsshsession.c                 |  19 +--
src/rpc/virnettlscontext.c                 |  39 ++---
src/secret/secret_driver.c                 |  14 +-
src/security/security_apparmor.c           |  38 ++---
src/security/security_dac.c                |  30 ++--
src/security/security_selinux.c            |  59 +++-----
src/security/security_util.c               |  14 +-
src/security/virt-aa-helper.c              |  73 ++-------
src/storage/storage_backend_disk.c         |   7 +-
src/storage/storage_backend_gluster.c      |  16 +-
src/storage/storage_backend_iscsi.c        |  13 +-
src/storage/storage_backend_iscsi_direct.c |  25 ++-
src/storage/storage_backend_logical.c      |  16 +-
src/storage/storage_backend_mpath.c        |   9 +-
src/storage/storage_backend_rbd.c          |  16 +-
src/storage/storage_backend_scsi.c         |  11 +-
src/storage/storage_backend_sheepdog.c     |   7 +-
src/storage/storage_backend_vstorage.c     |   6 +-
src/storage/storage_backend_zfs.c          |  13 +-
src/storage/storage_driver.c               |  17 +--
src/storage/storage_file_gluster.c         |  10 +-
src/storage/storage_util.c                 |  87 ++++-------
src/test/test_driver.c                     |  35 ++---
src/util/viraudit.c                        |   6 +-
src/util/virauth.c                         |  17 +--
src/util/virauthconfig.c                   |   9 +-
src/util/vircgroup.c                       |  39 ++---
src/util/vircgroupv1.c                     | 102 +++++--------
src/util/vircgroupv2.c                     |  97 ++++--------
src/util/vircommand.c                      |  12 +-
src/util/virconf.c                         |  10 +-
src/util/virdevmapper.c                    |   7 +-
src/util/virdnsmasq.c                      |  39 ++---
src/util/virebtables.c                     |   5 +-
src/util/virerror.c                        |   9 +-
src/util/virfile.c                         |  77 +++-------
src/util/virfirewall.c                     |   8 +-
src/util/virhostcpu.c                      |  11 +-
src/util/virhostdev.c                      |   3 +-
src/util/virhostmem.c                      |  21 +--
src/util/viriptables.c                     |  20 +--
src/util/viriscsi.c                        |   6 +-
src/util/virjson.c                         |  12 +-
src/util/virkmod.c                         |   3 +-
src/util/virlockspace.c                    |   2 +-
src/util/virlog.c                          | 115 ++++++--------
src/util/virlog.h                          |   2 +-
src/util/virmacmap.c                       |   2 +-
src/util/virmdev.c                         |  11 +-
src/util/virnetdev.c                       |  40 ++---
src/util/virnetdevbandwidth.c              |  61 +++-----
src/util/virnetdevbridge.c                 |  16 +-
src/util/virnetdevip.c                     |   5 +-
src/util/virnetdevmacvlan.c                |   6 +-
src/util/virnetdevopenvswitch.c            |  18 +--
src/util/virnetdevtap.c                    |   6 +-
src/util/virnetdevveth.c                   |   9 +-
src/util/virnuma.c                         |  29 ++--
src/util/virpci.c                          |  85 ++++-------
src/util/virpidfile.c                      |   9 +-
src/util/virprocess.c                      |  24 ++-
src/util/virqemu.c                         |   6 +-
src/util/virrandom.c                       |   5 +-
src/util/virresctrl.c                      |  21 +--
src/util/virrotatingfile.c                 |  12 +-
src/util/virscsi.c                         |  31 ++--
src/util/virscsihost.c                     |  18 +--
src/util/virscsivhost.c                    |   4 +-
src/util/virsocketaddr.c                   |  19 +--
src/util/virstoragefile.c                  |  14 +-
src/util/virstring.c                       |  50 +-----
src/util/virstring.h                       |  50 +-----
src/util/virsystemd.c                      |   3 +-
src/util/virtpm.c                          |  44 +++---
src/util/virtypedparam.c                   |  12 +-
src/util/viruri.c                          |   3 +-
src/util/virusb.c                          |  19 +--
src/util/virutil.c                         |  18 +--
src/util/virvhba.c                         |  52 +++----
src/vbox/vbox_MSCOMGlue.c                  |   4 +-
src/vbox/vbox_XPCOMCGlue.c                 |   3 +-
src/vbox/vbox_common.c                     |  62 ++++----
src/vbox/vbox_network.c                    |  13 +-
src/vbox/vbox_snapshot_conf.c              |  18 +--
src/vbox/vbox_storage.c                    |   5 +-
src/vbox/vbox_tmpl.c                       |  32 ++--
src/vmware/vmware_conf.c                   |  31 ++--
src/vmware/vmware_conf.h                   |   4 +-
src/vmx/vmx.c                              |  13 +-
src/vz/vz_driver.c                         |   3 +-
src/vz/vz_sdk.c                            |  46 ++----
tests/bhyveargv2xmltest.c                  |  10 +-
tests/bhyvexml2argvtest.c                  |  18 +--
tests/bhyvexml2xmltest.c                   |  10 +-
tests/commandtest.c                        |  27 ++--
tests/cputest.c                            |  95 +++++-------
tests/domaincapstest.c                     |  26 ++--
tests/domainconftest.c                     |   5 +-
tests/eventtest.c                          |   4 +-
tests/fchosttest.c                         |   7 +-
tests/fdstreamtest.c                       |   6 +-
tests/genericxml2xmltest.c                 |  10 +-
tests/interfacexml2xmltest.c               |   5 +-
tests/libxlxml2domconfigtest.c             |   8 +-
tests/lxcconf2xmltest.c                    |  20 +--
tests/lxcxml2xmltest.c                     |  10 +-
tests/networkxml2conftest.c                |   9 +-
tests/networkxml2firewalltest.c            |  16 +-
tests/networkxml2xmltest.c                 |   9 +-
tests/networkxml2xmlupdatetest.c           |  15 +-
tests/nodedevxml2xmltest.c                 |   5 +-
tests/nssmock.c                            |   9 +-
tests/nwfilterxml2firewalltest.c           |  15 +-
tests/nwfilterxml2xmltest.c                |   9 +-
tests/openvzutilstest.c                    |   6 +-
tests/qemuagenttest.c                      |   4 +-
tests/qemublocktest.c                      |  34 ++---
tests/qemucapabilitiestest.c               |  20 +--
tests/qemucaps2xmltest.c                   |  15 +-
tests/qemudomaincheckpointxml2xmltest.c    |   5 +-
tests/qemudomainsnapshotxml2xmltest.c      |   5 +-
tests/qemufirmwaretest.c                   |   4 +-
tests/qemuhotplugtest.c                    |  29 ++--
tests/qemumemlocktest.c                    |   5 +-
tests/qemumigparamstest.c                  |  23 ++-
tests/qemumonitorjsontest.c                |  56 +++----
tests/qemumonitortestutils.c               |  42 ++----
tests/qemusecuritymock.c                   |   5 +-
tests/qemusecuritytest.c                   |   3 +-
tests/qemuvhostusertest.c                  |   4 +-
tests/qemuxml2argvtest.c                   |  35 ++---
tests/qemuxml2xmltest.c                    |  41 ++---
tests/scsihosttest.c                       |  26 +---
tests/secretxml2xmltest.c                  |  14 +-
tests/securityselinuxlabeltest.c           |  23 +--
tests/storagebackendsheepdogtest.c         |  11 +-
tests/storagepoolcapstest.c                |   6 +-
tests/storagepoolxml2argvtest.c            |  11 +-
tests/storagepoolxml2xmltest.c             |   9 +-
tests/storagevolxml2argvtest.c             |  35 ++---
tests/storagevolxml2xmltest.c              |  13 +-
tests/sysinfotest.c                        |  18 +--
tests/testutils.c                          |  17 +--
tests/testutils.h                          |   5 +-
tests/testutilsqemu.c                      |  11 +-
tests/vboxsnapshotxmltest.c                |   5 +-
tests/virbuftest.c                         |   7 +-
tests/vircaps2xmltest.c                    |  15 +-
tests/vircgroupmock.c                      |  11 +-
tests/vircgrouptest.c                      |   5 +-
tests/virconftest.c                        |   7 +-
tests/virfilemock.c                        |   2 +-
tests/virfiletest.c                        |   3 +-
tests/virfilewrapper.c                     |   4 +-
tests/virhostcputest.c                     |  38 ++---
tests/virjsontest.c                        |  27 ++--
tests/virmacmaptest.c                      |  12 +-
tests/virnetdaemontest.c                   |  10 +-
tests/virnetdevmock.c                      |   8 +-
tests/virnetdevopenvswitchtest.c           |   5 +-
tests/virnetsockettest.c                   |   6 +-
tests/virnetworkportxml2xmltest.c          |   6 +-
tests/virnumamock.c                        |   3 +-
tests/virnwfilterbindingxml2xmltest.c      |   7 +-
tests/virpcimock.c                         | 103 +++++--------
tests/virpcitest.c                         |  16 +-
tests/virrandommock.c                      |   5 +-
tests/virresctrltest.c                     |  15 +-
tests/virschematest.c                      |  19 +--
tests/virscsitest.c                        |  11 +-
tests/virshtest.c                          |   5 +-
tests/virstoragetest.c                     |  63 ++++----
tests/virtestmock.c                        |   8 +-
tests/virusbmock.c                         |   9 +-
tests/virusbtest.c                         |   6 +-
tests/vmwarevertest.c                      |   4 +-
tests/vmx2xmltest.c                        |  18 +--
tests/xlconfigtest.c                       |   8 +-
tests/xmconfigtest.c                       |   8 +-
tests/xml2vmxtest.c                        |  16 +-
tools/virsh-completer-domain.c             |   7 +-
tools/virsh-completer-host.c               |  13 +-
tools/virsh-completer.c                    |   6 +-
tools/virsh-domain-monitor.c               |  21 ++-
tools/virsh-domain.c                       |  34 ++---
tools/virsh-host.c                         |   3 +-
tools/virsh-interface.c                    |  11 +-
tools/virsh-network.c                      |   3 +-
tools/virsh-pool.c                         |  15 +-
tools/virsh-volume.c                       |   9 +-
tools/virt-admin.c                         |   6 +-
tools/virt-host-validate-common.c          |  10 +-
tools/vsh.c                                |  53 ++-----
291 files changed, 2096 insertions(+), 3822 deletions(-)
[libvirt] [PATCH 00/75] Drop virAsprintf() in favor of g_strdup_printf()
Posted by Michal Privoznik 4 years, 6 months ago
You can find these also on my github:

  https://github.com/zippy2/libvirt/tree/virasprintf_void

Good luck.


Michal Prívozník (75):
  src: Don't rely on virAsprintf() returning string length
  qemu_command: Change logic in qemuVirCommandGet{FDSet,GetDevSet}
  access: Drop virAsprintf() and virAsprintfQuiet() retval checking
  bhyve: Drop virAsprintf() and virAsprintfQuiet() retval checking
  conf: Drop virAsprintf() and virAsprintfQuiet() retval checking
  cpu: Drop virAsprintf() and virAsprintfQuiet() retval checking
  esx: Drop virAsprintf() and virAsprintfQuiet() retval checking
  hyperv: Drop virAsprintf() and virAsprintfQuiet() retval checking
  interface: Drop virAsprintf() and virAsprintfQuiet() retval checking
  libxl: Drop virAsprintf() and virAsprintfQuiet() retval checking
  locking: Drop virAsprintf() and virAsprintfQuiet() retval checking
  logging: Drop virAsprintf() and virAsprintfQuiet() retval checking
  lxc: Drop virAsprintf() and virAsprintfQuiet() retval checking
  network: Drop virAsprintf() and virAsprintfQuiet() retval checking
  node_device: Drop virAsprintf() and virAsprintfQuiet() retval checking
  nwfilter: Drop virAsprintf() and virAsprintfQuiet() retval checking
  openvz: Drop virAsprintf() and virAsprintfQuiet() retval checking
  phyp: Drop virAsprintf() and virAsprintfQuiet() retval checking
  qemu: Drop virAsprintf() and virAsprintfQuiet() retval checking
  remote: Drop virAsprintf() and virAsprintfQuiet() retval checking
  rpc: Drop virAsprintf() and virAsprintfQuiet() retval checking
  security: Drop virAsprintf() and virAsprintfQuiet() retval checking
  storage: Drop virAsprintf() and virAsprintfQuiet() retval checking
  test: Drop virAsprintf() and virAsprintfQuiet() retval checking
  util: Drop virAsprintf() and virAsprintfQuiet() retval checking
  secret: Drop virAsprintf() and virAsprintfQuiet() retval checking
  vbox: Drop virAsprintf() and virAsprintfQuiet() retval checking
  vmware: Drop virAsprintf() and virAsprintfQuiet() retval checking
  vmx: Drop virAsprintf() and virAsprintfQuiet() retval checking
  vz: Drop virAsprintf() and virAsprintfQuiet() retval checking
  tests: Drop virAsprintf() and virAsprintfQuiet() retval checking
  tools: Drop virAsprintf() and virAsprintfQuiet() retval checking
  Drop virAsprintf() and virAsprintfQuiet() retval checking
  virstring: Make virAsprintf() return no value
  Rename virAsprintfQuiet() to virAsprintf()
  virstring: Drop virAsprintfQuiet()
  access: Use g_strdup_printf() instead of virAsprintf()
  bhyve: Use g_strdup_printf() instead of virAsprintf()
  conf: Use g_strdup_printf() instead of virAsprintf()
  cpu: Use g_strdup_printf() instead of virAsprintf()
  esx: Use g_strdup_printf() instead of virAsprintf()
  hyperv: Use g_strdup_printf() instead of virAsprintf()
  interface: Use g_strdup_printf() instead of virAsprintf()
  libxl: Use g_strdup_printf() instead of virAsprintf()
  locking: Use g_strdup_printf() instead of virAsprintf()
  logging: Use g_strdup_printf() instead of virAsprintf()
  lxc: Use g_strdup_printf() instead of virAsprintf()
  network: Use g_strdup_printf() instead of virAsprintf()
  node_device: Use g_strdup_printf() instead of virAsprintf()
  nwfilter: Use g_strdup_printf() instead of virAsprintf()
  openvz: Use g_strdup_printf() instead of virAsprintf()
  phyp: Use g_strdup_printf() instead of virAsprintf()
  qemu: Use g_strdup_printf() instead of virAsprintf()
  remote: Use g_strdup_printf() instead of virAsprintf()
  rpc: Use g_strdup_printf() instead of virAsprintf()
  secret: Use g_strdup_printf() instead of virAsprintf()
  security: Use g_strdup_printf() instead of virAsprintf()
  storage: Use g_strdup_printf() instead of virAsprintf()
  test: Use g_strdup_printf() instead of virAsprintf()
  util: Use g_strdup_printf() instead of virAsprintf()
  vbox: Use g_strdup_printf() instead of virAsprintf()
  vmware: Use g_strdup_printf() instead of virAsprintf()
  vmx: Use g_strdup_printf() instead of virAsprintf()
  vz: Use g_strdup_printf() instead of virAsprintf()
  tests: Use g_strdup_printf() instead of virAsprintf()
  tools: Use g_strdup_printf() instead of virAsprintf()
  Use g_strdup_printf instead of virAsprintf everywhere
  virpcimock: Make @fakerootdir static
  Drop virAsprintf()
  Rename virVasprintfQuiet() to virVasprintf()
  virstring: Drop virVasprintfQuiet()
  Drop virVasprintf() retval checking
  virstring: Make virVasprintf() return no value
  Use g_strdup_vprintf() instead of virVasprintf() everywhere
  Drop virVasprintf()

 build-aux/syntax-check.mk                  |  10 +-
 docs/hacking.html.in                       |  13 +-
 m4/virt-compile-warnings.m4                |   2 -
 src/access/viraccessdriverpolkit.c         |   6 +-
 src/bhyve/bhyve_capabilities.c             |   6 +-
 src/bhyve/bhyve_process.c                  |  16 +-
 src/conf/capabilities.c                    |   3 +-
 src/conf/domain_addr.c                     |   8 +-
 src/conf/domain_audit.c                    |  60 +++-----
 src/conf/domain_conf.c                     |  48 +++---
 src/conf/moment_conf.c                     |   5 +-
 src/conf/network_conf.c                    |   2 +-
 src/conf/node_device_util.c                |   3 +-
 src/conf/snapshot_conf.c                   |   5 +-
 src/conf/storage_conf.c                    |   6 +-
 src/conf/virchrdev.c                       |   7 +-
 src/conf/virnetworkobj.c                   |   8 +-
 src/conf/virnetworkportdef.c               |   2 +-
 src/conf/virnwfilterbindingobj.c           |   2 +-
 src/conf/virstorageobj.c                   |   3 +-
 src/cpu/cpu_ppc64.c                        |  30 ++--
 src/cpu/cpu_x86.c                          |  27 ++--
 src/driver.c                               |   6 +-
 src/esx/esx_driver.c                       |  54 +++----
 src/esx/esx_storage_backend_vmfs.c         |  67 +++-----
 src/esx/esx_stream.c                       |  11 +-
 src/esx/esx_vi.c                           |  31 ++--
 src/hyperv/hyperv_driver.c                 |  11 +-
 src/hyperv/hyperv_wmi.c                    |  23 +--
 src/interface/interface_backend_netcf.c    |   7 +-
 src/interface/interface_backend_udev.c     |  14 +-
 src/libvirt-admin.c                        |  12 +-
 src/libvirt_private.syms                   |   2 -
 src/libxl/libxl_conf.c                     |  34 ++---
 src/libxl/libxl_domain.c                   |  34 ++---
 src/libxl/libxl_domain.h                   |   2 +-
 src/libxl/libxl_driver.c                   |  19 +--
 src/libxl/libxl_logger.c                   |  14 +-
 src/libxl/libxl_migration.c                |   9 +-
 src/libxl/xen_common.c                     |  11 +-
 src/libxl/xen_xl.c                         |  18 +--
 src/libxl/xen_xm.c                         |   6 +-
 src/locking/lock_daemon.c                  |  17 +--
 src/locking/lock_daemon_config.c           |   5 +-
 src/locking/lock_driver_lockd.c            |   9 +-
 src/locking/lock_driver_sanlock.c          |  12 +-
 src/locking/lock_manager.c                 |   4 +-
 src/logging/log_daemon.c                   |  26 +---
 src/logging/log_daemon_config.c            |   5 +-
 src/logging/log_manager.c                  |   5 +-
 src/lxc/lxc_container.c                    |  68 ++++-----
 src/lxc/lxc_controller.c                   |  79 ++++------
 src/lxc/lxc_driver.c                       |  15 +-
 src/lxc/lxc_fuse.c                         |  10 +-
 src/lxc/lxc_monitor.c                      |   4 +-
 src/lxc/lxc_native.c                       |  11 +-
 src/lxc/lxc_process.c                      |  35 ++---
 src/network/bridge_driver.c                |  69 ++++-----
 src/network/leaseshelper.c                 |   6 +-
 src/node_device/node_device_driver.c       |   3 +-
 src/node_device/node_device_hal.c          |   7 +-
 src/node_device/node_device_udev.c         |  11 +-
 src/nwfilter/nwfilter_dhcpsnoop.c          |  16 +-
 src/openvz/openvz_conf.c                   |  18 +--
 src/openvz/openvz_driver.c                 |   7 +-
 src/phyp/phyp_driver.c                     |  19 +--
 src/qemu/qemu_agent.c                      |   9 +-
 src/qemu/qemu_alias.c                      | 114 +++++++-------
 src/qemu/qemu_block.c                      |  45 +++---
 src/qemu/qemu_blockjob.c                   |  12 +-
 src/qemu/qemu_capabilities.c               |  14 +-
 src/qemu/qemu_checkpoint.c                 |  11 +-
 src/qemu/qemu_command.c                    | 113 ++++++--------
 src/qemu/qemu_conf.c                       | 141 ++++++-----------
 src/qemu/qemu_conf.h                       |   4 +-
 src/qemu/qemu_domain.c                     | 168 ++++++++-------------
 src/qemu/qemu_domain.h                     |   6 +-
 src/qemu/qemu_driver.c                     |   6 +-
 src/qemu/qemu_firmware.c                   |   3 +-
 src/qemu/qemu_hotplug.c                    |  80 ++++------
 src/qemu/qemu_interface.c                  |   5 +-
 src/qemu/qemu_interop_config.c             |   9 +-
 src/qemu/qemu_migration.c                  |  33 ++--
 src/qemu/qemu_migration_cookie.c           |   3 +-
 src/qemu/qemu_monitor.c                    |  33 ++--
 src/qemu/qemu_monitor_json.c               |  26 +---
 src/qemu/qemu_monitor_text.c               |  15 +-
 src/qemu/qemu_process.c                    |  74 +++------
 src/qemu/qemu_slirp.c                      |  18 +--
 src/qemu/qemu_tpm.c                        |  19 +--
 src/qemu/qemu_vhost_user_gpu.c             |   3 +-
 src/remote/remote_daemon.c                 |  37 ++---
 src/remote/remote_daemon_config.c          |   5 +-
 src/remote/remote_daemon_dispatch.c        |  20 +--
 src/remote/remote_driver.c                 |  20 +--
 src/rpc/virnetclient.c                     |  23 +--
 src/rpc/virnetlibsshsession.c              |  17 +--
 src/rpc/virnetsocket.c                     |   3 +-
 src/rpc/virnetsshsession.c                 |  19 +--
 src/rpc/virnettlscontext.c                 |  39 ++---
 src/secret/secret_driver.c                 |  14 +-
 src/security/security_apparmor.c           |  38 ++---
 src/security/security_dac.c                |  30 ++--
 src/security/security_selinux.c            |  59 +++-----
 src/security/security_util.c               |  14 +-
 src/security/virt-aa-helper.c              |  73 ++-------
 src/storage/storage_backend_disk.c         |   7 +-
 src/storage/storage_backend_gluster.c      |  16 +-
 src/storage/storage_backend_iscsi.c        |  13 +-
 src/storage/storage_backend_iscsi_direct.c |  25 ++-
 src/storage/storage_backend_logical.c      |  16 +-
 src/storage/storage_backend_mpath.c        |   9 +-
 src/storage/storage_backend_rbd.c          |  16 +-
 src/storage/storage_backend_scsi.c         |  11 +-
 src/storage/storage_backend_sheepdog.c     |   7 +-
 src/storage/storage_backend_vstorage.c     |   6 +-
 src/storage/storage_backend_zfs.c          |  13 +-
 src/storage/storage_driver.c               |  17 +--
 src/storage/storage_file_gluster.c         |  10 +-
 src/storage/storage_util.c                 |  87 ++++-------
 src/test/test_driver.c                     |  35 ++---
 src/util/viraudit.c                        |   6 +-
 src/util/virauth.c                         |  17 +--
 src/util/virauthconfig.c                   |   9 +-
 src/util/vircgroup.c                       |  39 ++---
 src/util/vircgroupv1.c                     | 102 +++++--------
 src/util/vircgroupv2.c                     |  97 ++++--------
 src/util/vircommand.c                      |  12 +-
 src/util/virconf.c                         |  10 +-
 src/util/virdevmapper.c                    |   7 +-
 src/util/virdnsmasq.c                      |  39 ++---
 src/util/virebtables.c                     |   5 +-
 src/util/virerror.c                        |   9 +-
 src/util/virfile.c                         |  77 +++-------
 src/util/virfirewall.c                     |   8 +-
 src/util/virhostcpu.c                      |  11 +-
 src/util/virhostdev.c                      |   3 +-
 src/util/virhostmem.c                      |  21 +--
 src/util/viriptables.c                     |  20 +--
 src/util/viriscsi.c                        |   6 +-
 src/util/virjson.c                         |  12 +-
 src/util/virkmod.c                         |   3 +-
 src/util/virlockspace.c                    |   2 +-
 src/util/virlog.c                          | 115 ++++++--------
 src/util/virlog.h                          |   2 +-
 src/util/virmacmap.c                       |   2 +-
 src/util/virmdev.c                         |  11 +-
 src/util/virnetdev.c                       |  40 ++---
 src/util/virnetdevbandwidth.c              |  61 +++-----
 src/util/virnetdevbridge.c                 |  16 +-
 src/util/virnetdevip.c                     |   5 +-
 src/util/virnetdevmacvlan.c                |   6 +-
 src/util/virnetdevopenvswitch.c            |  18 +--
 src/util/virnetdevtap.c                    |   6 +-
 src/util/virnetdevveth.c                   |   9 +-
 src/util/virnuma.c                         |  29 ++--
 src/util/virpci.c                          |  85 ++++-------
 src/util/virpidfile.c                      |   9 +-
 src/util/virprocess.c                      |  24 ++-
 src/util/virqemu.c                         |   6 +-
 src/util/virrandom.c                       |   5 +-
 src/util/virresctrl.c                      |  21 +--
 src/util/virrotatingfile.c                 |  12 +-
 src/util/virscsi.c                         |  31 ++--
 src/util/virscsihost.c                     |  18 +--
 src/util/virscsivhost.c                    |   4 +-
 src/util/virsocketaddr.c                   |  19 +--
 src/util/virstoragefile.c                  |  14 +-
 src/util/virstring.c                       |  50 +-----
 src/util/virstring.h                       |  50 +-----
 src/util/virsystemd.c                      |   3 +-
 src/util/virtpm.c                          |  44 +++---
 src/util/virtypedparam.c                   |  12 +-
 src/util/viruri.c                          |   3 +-
 src/util/virusb.c                          |  19 +--
 src/util/virutil.c                         |  18 +--
 src/util/virvhba.c                         |  52 +++----
 src/vbox/vbox_MSCOMGlue.c                  |   4 +-
 src/vbox/vbox_XPCOMCGlue.c                 |   3 +-
 src/vbox/vbox_common.c                     |  62 ++++----
 src/vbox/vbox_network.c                    |  13 +-
 src/vbox/vbox_snapshot_conf.c              |  18 +--
 src/vbox/vbox_storage.c                    |   5 +-
 src/vbox/vbox_tmpl.c                       |  32 ++--
 src/vmware/vmware_conf.c                   |  31 ++--
 src/vmware/vmware_conf.h                   |   4 +-
 src/vmx/vmx.c                              |  13 +-
 src/vz/vz_driver.c                         |   3 +-
 src/vz/vz_sdk.c                            |  46 ++----
 tests/bhyveargv2xmltest.c                  |  10 +-
 tests/bhyvexml2argvtest.c                  |  18 +--
 tests/bhyvexml2xmltest.c                   |  10 +-
 tests/commandtest.c                        |  27 ++--
 tests/cputest.c                            |  95 +++++-------
 tests/domaincapstest.c                     |  26 ++--
 tests/domainconftest.c                     |   5 +-
 tests/eventtest.c                          |   4 +-
 tests/fchosttest.c                         |   7 +-
 tests/fdstreamtest.c                       |   6 +-
 tests/genericxml2xmltest.c                 |  10 +-
 tests/interfacexml2xmltest.c               |   5 +-
 tests/libxlxml2domconfigtest.c             |   8 +-
 tests/lxcconf2xmltest.c                    |  20 +--
 tests/lxcxml2xmltest.c                     |  10 +-
 tests/networkxml2conftest.c                |   9 +-
 tests/networkxml2firewalltest.c            |  16 +-
 tests/networkxml2xmltest.c                 |   9 +-
 tests/networkxml2xmlupdatetest.c           |  15 +-
 tests/nodedevxml2xmltest.c                 |   5 +-
 tests/nssmock.c                            |   9 +-
 tests/nwfilterxml2firewalltest.c           |  15 +-
 tests/nwfilterxml2xmltest.c                |   9 +-
 tests/openvzutilstest.c                    |   6 +-
 tests/qemuagenttest.c                      |   4 +-
 tests/qemublocktest.c                      |  34 ++---
 tests/qemucapabilitiestest.c               |  20 +--
 tests/qemucaps2xmltest.c                   |  15 +-
 tests/qemudomaincheckpointxml2xmltest.c    |   5 +-
 tests/qemudomainsnapshotxml2xmltest.c      |   5 +-
 tests/qemufirmwaretest.c                   |   4 +-
 tests/qemuhotplugtest.c                    |  29 ++--
 tests/qemumemlocktest.c                    |   5 +-
 tests/qemumigparamstest.c                  |  23 ++-
 tests/qemumonitorjsontest.c                |  56 +++----
 tests/qemumonitortestutils.c               |  42 ++----
 tests/qemusecuritymock.c                   |   5 +-
 tests/qemusecuritytest.c                   |   3 +-
 tests/qemuvhostusertest.c                  |   4 +-
 tests/qemuxml2argvtest.c                   |  35 ++---
 tests/qemuxml2xmltest.c                    |  41 ++---
 tests/scsihosttest.c                       |  26 +---
 tests/secretxml2xmltest.c                  |  14 +-
 tests/securityselinuxlabeltest.c           |  23 +--
 tests/storagebackendsheepdogtest.c         |  11 +-
 tests/storagepoolcapstest.c                |   6 +-
 tests/storagepoolxml2argvtest.c            |  11 +-
 tests/storagepoolxml2xmltest.c             |   9 +-
 tests/storagevolxml2argvtest.c             |  35 ++---
 tests/storagevolxml2xmltest.c              |  13 +-
 tests/sysinfotest.c                        |  18 +--
 tests/testutils.c                          |  17 +--
 tests/testutils.h                          |   5 +-
 tests/testutilsqemu.c                      |  11 +-
 tests/vboxsnapshotxmltest.c                |   5 +-
 tests/virbuftest.c                         |   7 +-
 tests/vircaps2xmltest.c                    |  15 +-
 tests/vircgroupmock.c                      |  11 +-
 tests/vircgrouptest.c                      |   5 +-
 tests/virconftest.c                        |   7 +-
 tests/virfilemock.c                        |   2 +-
 tests/virfiletest.c                        |   3 +-
 tests/virfilewrapper.c                     |   4 +-
 tests/virhostcputest.c                     |  38 ++---
 tests/virjsontest.c                        |  27 ++--
 tests/virmacmaptest.c                      |  12 +-
 tests/virnetdaemontest.c                   |  10 +-
 tests/virnetdevmock.c                      |   8 +-
 tests/virnetdevopenvswitchtest.c           |   5 +-
 tests/virnetsockettest.c                   |   6 +-
 tests/virnetworkportxml2xmltest.c          |   6 +-
 tests/virnumamock.c                        |   3 +-
 tests/virnwfilterbindingxml2xmltest.c      |   7 +-
 tests/virpcimock.c                         | 103 +++++--------
 tests/virpcitest.c                         |  16 +-
 tests/virrandommock.c                      |   5 +-
 tests/virresctrltest.c                     |  15 +-
 tests/virschematest.c                      |  19 +--
 tests/virscsitest.c                        |  11 +-
 tests/virshtest.c                          |   5 +-
 tests/virstoragetest.c                     |  63 ++++----
 tests/virtestmock.c                        |   8 +-
 tests/virusbmock.c                         |   9 +-
 tests/virusbtest.c                         |   6 +-
 tests/vmwarevertest.c                      |   4 +-
 tests/vmx2xmltest.c                        |  18 +--
 tests/xlconfigtest.c                       |   8 +-
 tests/xmconfigtest.c                       |   8 +-
 tests/xml2vmxtest.c                        |  16 +-
 tools/virsh-completer-domain.c             |   7 +-
 tools/virsh-completer-host.c               |  13 +-
 tools/virsh-completer.c                    |   6 +-
 tools/virsh-domain-monitor.c               |  21 ++-
 tools/virsh-domain.c                       |  34 ++---
 tools/virsh-host.c                         |   3 +-
 tools/virsh-interface.c                    |  11 +-
 tools/virsh-network.c                      |   3 +-
 tools/virsh-pool.c                         |  15 +-
 tools/virsh-volume.c                       |   9 +-
 tools/virt-admin.c                         |   6 +-
 tools/virt-host-validate-common.c          |  10 +-
 tools/vsh.c                                |  53 ++-----
 291 files changed, 2096 insertions(+), 3822 deletions(-)

-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 00/75] Drop virAsprintf() in favor of g_strdup_printf()
Posted by Michal Privoznik 4 years, 6 months ago
On 10/22/19 3:57 PM, Michal Privoznik wrote:
 >
For future reference and anybody interested, I've made these changes using
coccinelle http://coccinelle.lip6.fr/

I've used three semantic patches (aka spatch). The first one was to rename
virAsprintfQueit() to virAsprintf(). It is trivial:

   $ cat virasprintf_rename.spatch
   @@
   @@
   -virAsprintfQuiet
   +virAsprintf

Runnig coccinelle is fairly easy now that Jano pushed the macro file [1]:

   libvirt.git $ spatch --in-place --macro-file scripts/cocci-macro-file.h \
       --sp-file virasprintf_rename.spatch --dir .


The second spatch is a bit more complicated/verbose:

    $ cat virasprintf_no_return.spatch
    @@
    expression e1, e2, e3;
    statement S;
    @@
    -if (virAsprintf(e1, e2, e3) < 0)
    -S
    +virAsprintf(e1, e2, e3);


    @@
    expression e1, e2, e3, e4;
    statement S;
    @@
    -if (virAsprintf(e1, e2, e3, e4) < 0)
    -S
    +virAsprintf(e1, e2, e3, e4);

    [this pattern continues 3 more times, each time new argument is added]

It is here that I've encountered first problems. Firstly, my spatch 
skills are
not good enough (obviously), because I had to write several rules - each 
one for
different number of arguments passed to virAsprintf(). But more importantly,
I've completely missed joined statements like:

   if (virAsprintf() < 0 ||
       virAsprintf() < 0)
       goto cleanup;

On the other hand, I was left with only a few places that needed fixing.
Coccinelle did 90% of conversion and I needed to do the rest by hand, 
which is a
fair trade off IMO.


Finally, the last spatch was used to rewrite code from using 
virAsprintf() to
g_strdup_printf:

   $ cat g_strdup_printf.spatch
   @@
   expression x;
   @@
   -virAsprintf(&x,
   +x = g_strdup_printf(
    ...
    );

Again, worked perfectly except few places where we did not pass &x but x 
(which
was char **). I've tried to make an spatch for that too but didn't 
succeed, so
I've fixed those places by hand.

Michal

1: Thing is, while coccinelle understands C very well, it doesn't quite
understand all those __attribute__ and other extensions. Therefore, some 
macros
made it impossible for coccinelle to parse some functions (e.g. g_autofree,
g_autoptr and similar) and it did not perform requested change there then.

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 00/75] Drop virAsprintf() in favor of g_strdup_printf()
Posted by Richard W.M. Jones 4 years, 6 months ago
On Wed, Oct 23, 2019 at 10:18:58AM +0200, Michal Privoznik wrote:
[...]

Thanks for the explanation.  In case you didn't discover it, cocci has
a very responsive upstream mailing list:

https://systeme.lip6.fr/mailman/listinfo/cocci

> 1: Thing is, while coccinelle understands C very well, it doesn't quite
> understand all those __attribute__ and other extensions. Therefore,
> some macros
> made it impossible for coccinelle to parse some functions (e.g. g_autofree,
> g_autoptr and similar) and it did not perform requested change there then.

They might be interested in if there's anything that can be done about
this.  In libguestfs, nbdkit etc we are extensively using the cleanup
attribute, and so is systemd.  I've even seen [somewhere, can't find
it at the moment] a proposal to add the equivalent feature to the next
C standard.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list