[PATCH 1/5] virutil: Move string related functions to virstring.c

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

 



---
 cfg.mk                                    |   4 +-
 daemon/libvirtd-config.c                  |  12 +-
 daemon/libvirtd.c                         |  14 +-
 daemon/remote.c                           |  35 ++-
 python/libvirt-override.c                 |   6 +-
 src/conf/capabilities.c                   |   1 -
 src/conf/cpu_conf.c                       |   8 +-
 src/conf/cpu_conf.h                       |   6 +-
 src/conf/device_conf.c                    |  11 +-
 src/conf/device_conf.h                    |   4 +-
 src/conf/domain_audit.c                   |   5 +-
 src/conf/domain_conf.c                    |  30 +--
 src/conf/domain_conf.h                    |   1 -
 src/conf/domain_nwfilter.h                |   2 +
 src/conf/interface_conf.c                 |   1 -
 src/conf/interface_conf.h                 |   2 +-
 src/conf/netdev_bandwidth_conf.c          |   6 +-
 src/conf/netdev_vport_profile_conf.c      |   3 +-
 src/conf/network_conf.c                   |  14 +-
 src/conf/node_device_conf.c               |   1 -
 src/conf/node_device_conf.h               |   4 +-
 src/conf/nwfilter_conf.c                  |  13 +-
 src/conf/nwfilter_conf.h                  |   1 -
 src/conf/nwfilter_params.c                |   7 +-
 src/conf/secret_conf.c                    |   1 -
 src/conf/snapshot_conf.c                  |  16 +-
 src/conf/storage_conf.c                   |   8 +-
 src/conf/storage_conf.h                   |   1 -
 src/conf/storage_encryption_conf.c        |   1 -
 src/conf/virchrdev.c                      |  11 +-
 src/cpu/cpu_map.h                         |   2 +-
 src/cpu/cpu_powerpc.c                     |   1 -
 src/cpu/cpu_x86.c                         |   7 +-
 src/datatypes.c                           |   1 -
 src/driver.c                              |   4 +-
 src/esx/esx_device_monitor.c              |   1 -
 src/esx/esx_driver.c                      |  26 +--
 src/esx/esx_interface_driver.c            |   1 -
 src/esx/esx_network_driver.c              |   1 -
 src/esx/esx_nwfilter_driver.c             |   1 -
 src/esx/esx_secret_driver.c               |   1 -
 src/esx/esx_storage_backend_iscsi.c       |   1 -
 src/esx/esx_storage_backend_vmfs.c        |  16 +-
 src/esx/esx_util.c                        |   8 +-
 src/esx/esx_vi.c                          |  12 +-
 src/esx/esx_vi_types.c                    |   8 +-
 src/fdstream.c                            |   9 +-
 src/hyperv/hyperv_device_monitor.c        |   1 -
 src/hyperv/hyperv_driver.c                |  18 +-
 src/hyperv/hyperv_interface_driver.c      |   1 -
 src/hyperv/hyperv_network_driver.c        |   1 -
 src/hyperv/hyperv_nwfilter_driver.c       |   1 -
 src/hyperv/hyperv_secret_driver.c         |   1 -
 src/hyperv/hyperv_storage_driver.c        |   1 -
 src/hyperv/hyperv_util.c                  |   1 -
 src/hyperv/hyperv_wmi.c                   |  12 +-
 src/interface/interface_backend_udev.c    |   5 +-
 src/libvirt.c                             |  23 +-
 src/libvirt_private.syms                  |  32 +--
 src/libxl/libxl_driver.c                  |  21 +-
 src/locking/lock_daemon.c                 |  15 +-
 src/locking/lock_daemon_config.c          |   8 +-
 src/locking/lock_daemon_dispatch.c        |   1 -
 src/locking/lock_driver_lockd.c           |  16 +-
 src/locking/lock_driver_sanlock.c         |   1 -
 src/locking/lock_manager.c                |  15 +-
 src/lxc/lxc_cgroup.c                      |   7 +-
 src/lxc/lxc_container.c                   |  14 +-
 src/lxc/lxc_controller.c                  |  20 +-
 src/lxc/lxc_driver.c                      |  30 +--
 src/lxc/lxc_fuse.c                        |   7 +-
 src/lxc/lxc_fuse.h                        |   1 -
 src/lxc/lxc_monitor.c                     |   3 +-
 src/lxc/lxc_process.c                     |  29 +--
 src/network/bridge_driver.c               |  24 +-
 src/node_device/node_device_driver.c      |   1 -
 src/node_device/node_device_linux_sysfs.c |   5 +-
 src/node_device/node_device_udev.c        |  14 +-
 src/nodeinfo.c                            |  13 +-
 src/nwfilter/nwfilter_dhcpsnoop.c         |  17 +-
 src/nwfilter/nwfilter_dhcpsnoop.h         |   2 +
 src/nwfilter/nwfilter_driver.c            |   7 +-
 src/nwfilter/nwfilter_ebiptables_driver.c |  18 +-
 src/nwfilter/nwfilter_ebiptables_driver.h |   2 +
 src/nwfilter/nwfilter_learnipaddr.c       |  19 +-
 src/openvz/openvz_conf.c                  |  12 +-
 src/openvz/openvz_driver.c                |  16 +-
 src/parallels/parallels_driver.c          |  12 +-
 src/parallels/parallels_network.c         |   3 +-
 src/parallels/parallels_storage.c         |   5 +-
 src/parallels/parallels_utils.c           |   3 +-
 src/phyp/phyp_driver.c                    |  22 +-
 src/qemu/qemu_agent.c                     |   7 +-
 src/qemu/qemu_bridge_filter.c             |   1 -
 src/qemu/qemu_bridge_filter.h             |   1 +
 src/qemu/qemu_capabilities.c              |  18 +-
 src/qemu/qemu_cgroup.c                    |   1 -
 src/qemu/qemu_command.c                   |   1 -
 src/qemu/qemu_conf.c                      |   1 -
 src/qemu/qemu_domain.c                    |  17 +-
 src/qemu/qemu_driver.c                    |  52 ++---
 src/qemu/qemu_hotplug.c                   |  27 +--
 src/qemu/qemu_migration.c                 |  20 +-
 src/qemu/qemu_monitor.c                   |   9 +-
 src/qemu/qemu_monitor_json.c              |  13 +-
 src/qemu/qemu_monitor_text.c              |  13 +-
 src/qemu/qemu_process.c                   |  28 +--
 src/remote/remote_driver.c                |  26 +--
 src/rpc/virkeepalive.c                    |   1 -
 src/rpc/virnetclient.c                    |  10 +-
 src/rpc/virnetclientprogram.c             |   4 +-
 src/rpc/virnetmessage.c                   |   4 +-
 src/rpc/virnetserver.c                    |  10 +-
 src/rpc/virnetserverclient.c              |   8 +-
 src/rpc/virnetsocket.c                    |   9 +-
 src/rpc/virnetsshsession.c                |   9 +-
 src/rpc/virnettlscontext.c                |   5 +-
 src/secret/secret_driver.c                |  14 +-
 src/security/security_apparmor.c          |  14 +-
 src/security/security_dac.c               |   6 +-
 src/security/security_selinux.c           |  15 +-
 src/security/virt-aa-helper.c             |  16 +-
 src/storage/parthelper.c                  |   2 +-
 src/storage/storage_backend.c             |  14 +-
 src/storage/storage_backend_disk.c        |   8 +-
 src/storage/storage_backend_fs.c          |   9 +-
 src/storage/storage_backend_iscsi.c       |  10 +-
 src/storage/storage_backend_logical.c     |   7 +-
 src/storage/storage_backend_mpath.c       |   7 +-
 src/storage/storage_backend_rbd.c         |   1 -
 src/storage/storage_backend_scsi.c        |   7 +-
 src/storage/storage_backend_sheepdog.c    |   1 -
 src/storage/storage_driver.c              |  14 +-
 src/test/test_driver.c                    |  28 +--
 src/uml/uml_conf.c                        |  15 +-
 src/uml/uml_driver.c                      |  26 +--
 src/util/iohelper.c                       |   9 +-
 src/util/viraudit.c                       |   8 +-
 src/util/virauth.c                        |  13 +-
 src/util/virauthconfig.c                  |   7 +-
 src/util/virbitmap.c                      |   8 +-
 src/util/vircgroup.c                      |   4 +-
 src/util/vircommand.c                     |   9 +-
 src/util/vircommand.h                     |   1 -
 src/util/virconf.c                        |  10 +-
 src/util/virdnsmasq.c                     |  11 +-
 src/util/virebtables.c                    |   6 +-
 src/util/virerror.c                       |   5 +-
 src/util/vireventpoll.c                   |  10 +-
 src/util/virfile.c                        |   3 +-
 src/util/virhook.c                        |  10 +-
 src/util/virhook.h                        |   1 -
 src/util/virinitctl.c                     |   7 +-
 src/util/viriptables.c                    |   6 +-
 src/util/virjson.c                        |   3 +-
 src/util/virkeyfile.c                     |   6 +-
 src/util/virlockspace.c                   |   7 +-
 src/util/virlog.c                         |  11 +-
 src/util/virnetdev.c                      |  14 +-
 src/util/virnetdevbandwidth.c             |   5 +-
 src/util/virnetdevbridge.c                |   9 +-
 src/util/virnetdevmacvlan.c               |   1 -
 src/util/virnetdevopenvswitch.c           |   5 +-
 src/util/virnetdevopenvswitch.h           |   1 -
 src/util/virnetdevtap.c                   |  14 +-
 src/util/virnetdevveth.c                  |   6 +-
 src/util/virnetdevvportprofile.c          |   6 +-
 src/util/virnetdevvportprofile.h          |   4 +-
 src/util/virpci.c                         |   4 +-
 src/util/virpidfile.c                     |  15 +-
 src/util/virprocess.c                     |  11 +-
 src/util/virrandom.c                      |   9 +-
 src/util/virsexpr.c                       |   4 +-
 src/util/virsocketaddr.c                  |   8 +-
 src/util/virstatslinux.c                  |   1 -
 src/util/virstoragefile.c                 |   9 +-
 src/util/virstring.c                      | 335 ++++++++++++++++++++++++++++
 src/util/virstring.h                      |  51 +++++
 src/util/virsysinfo.c                     |   8 +-
 src/util/virsysinfo.h                     |   2 +-
 src/util/virtime.c                        |   1 -
 src/util/virtypedparam.c                  |   3 +-
 src/util/viruri.c                         |   4 +-
 src/util/virusb.c                         |   7 +-
 src/util/virutil.c                        | 350 +-----------------------------
 src/util/virutil.h                        |  49 +----
 src/util/viruuid.c                        |   2 +-
 src/util/virxml.c                         |   9 +-
 src/vbox/vbox_MSCOMGlue.c                 |   1 -
 src/vbox/vbox_XPCOMCGlue.c                |   7 +-
 src/vbox/vbox_driver.c                    |   1 -
 src/vbox/vbox_tmpl.c                      |  23 +-
 src/vmware/vmware_conf.c                  |   7 +-
 src/vmware/vmware_driver.c                |   1 -
 src/vmx/vmx.c                             |   7 +-
 src/xen/block_stats.c                     |   6 +-
 src/xen/xen_driver.c                      |  20 +-
 src/xen/xen_hypervisor.c                  |  26 +--
 src/xen/xend_internal.c                   |  22 +-
 src/xen/xm_internal.c                     |  20 +-
 src/xenapi/xenapi_driver.c                |  20 +-
 src/xenapi/xenapi_utils.c                 |  16 +-
 src/xenxs/xen_sxpr.c                      |  15 +-
 src/xenxs/xen_xm.c                        |  19 +-
 tests/commandhelper.c                     |   4 +-
 tests/commandtest.c                       |   6 +-
 tests/cputest.c                           |  11 +-
 tests/domainsnapshotxml2xmltest.c         |   3 +-
 tests/esxutilstest.c                      |   1 -
 tests/eventtest.c                         |   6 +-
 tests/interfacexml2xmltest.c              |   4 +-
 tests/libvirtdconftest.c                  |   9 +-
 tests/lxcxml2xmltest.c                    |   3 +-
 tests/networkxml2conftest.c               |   7 +-
 tests/networkxml2xmltest.c                |   3 +-
 tests/nodedevxml2xmltest.c                |   3 +-
 tests/nodeinfotest.c                      |   4 +-
 tests/nwfilterxml2xmltest.c               |   9 +-
 tests/openvzutilstest.c                   |   6 +-
 tests/qemuargv2xmltest.c                  |   4 +-
 tests/qemuhelptest.c                      |   3 +-
 tests/qemumonitortest.c                   |   1 -
 tests/qemumonitortestutils.c              |   6 +-
 tests/qemuxml2argvtest.c                  |  10 +-
 tests/qemuxml2xmltest.c                   |   3 +-
 tests/qemuxmlnstest.c                     |   8 +-
 tests/securityselinuxlabeltest.c          |   7 +-
 tests/securityselinuxtest.c               |   7 +-
 tests/sexpr2xmltest.c                     |   7 +-
 tests/storagepoolxml2xmltest.c            |   3 +-
 tests/storagevolxml2argvtest.c            |   5 +-
 tests/storagevolxml2xmltest.c             |   3 +-
 tests/sysinfotest.c                       |   7 +-
 tests/testutils.c                         |  26 ++-
 tests/utiltest.c                          |   3 +-
 tests/virauthconfigtest.c                 |   1 -
 tests/virbuftest.c                        |   4 +-
 tests/virdrivermoduletest.c               |   1 -
 tests/virhashtest.c                       |   7 +-
 tests/viridentitytest.c                   |   1 -
 tests/virkeyfiletest.c                    |   1 -
 tests/virlockspacetest.c                  |  10 +-
 tests/virnetmessagetest.c                 |   1 -
 tests/virnetsockettest.c                  |  10 +-
 tests/virnettlscontexttest.c              |  10 +-
 tests/virportallocatortest.c              |   5 +-
 tests/virshtest.c                         |   4 +-
 tests/virstoragetest.c                    |   1 +
 tests/virstringtest.c                     |   1 -
 tests/virtimetest.c                       |   1 -
 tests/viruritest.c                        |   1 -
 tests/vmx2xmltest.c                       |   3 +-
 tests/xencapstest.c                       |   5 +-
 tests/xmconfigtest.c                      |   9 +-
 tests/xml2sexprtest.c                     |   5 +-
 tests/xml2vmxtest.c                       |   3 +-
 tools/console.c                           |   1 -
 tools/virsh-domain-monitor.c              |   3 +-
 tools/virsh-domain.c                      |   1 -
 tools/virsh-host.c                        |   6 +-
 tools/virsh-interface.c                   |   3 +-
 tools/virsh-network.c                     |   1 -
 tools/virsh-nodedev.c                     |   1 -
 tools/virsh-nwfilter.c                    |   2 +-
 tools/virsh-pool.c                        |   6 +-
 tools/virsh-secret.c                      |   4 +-
 tools/virsh-snapshot.c                    |   1 -
 tools/virsh-volume.c                      |   5 +-
 tools/virsh.c                             |  26 +--
 tools/virt-host-validate-common.c         |   3 +-
 270 files changed, 1505 insertions(+), 1455 deletions(-)

diff --git a/cfg.mk b/cfg.mk
index 394521e..7a2c69f 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -812,7 +812,7 @@ exclude_file_name_regexp--sc_prohibit_always_true_header_tests = \
   ^python/(libvirt-(lxc-|qemu-)?override|typewrappers)\.c$$
 
 exclude_file_name_regexp--sc_prohibit_asprintf = \
-  ^(bootstrap.conf$$|src/util/virutil\.c$$|examples/domain-events/events-c/event-test\.c$$)
+  ^(bootstrap.conf$$|src/util/virstring\.c$$|examples/domain-events/events-c/event-test\.c$$)
 
 exclude_file_name_regexp--sc_prohibit_close = \
   (\.p[yl]$$|^docs/|^(src/util/virfile\.c|src/libvirt\.c)$$)
@@ -846,7 +846,7 @@ exclude_file_name_regexp--sc_prohibit_setuid = ^src/util/virutil\.c$$
 exclude_file_name_regexp--sc_prohibit_sprintf = \
   ^(docs/hacking\.html\.in)|(examples/systemtap/.*stp)|(src/dtrace2systemtap\.pl)|(src/rpc/gensystemtap\.pl)$$
 
-exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virutil\.c$$
+exclude_file_name_regexp--sc_prohibit_strncpy = ^src/util/virstring\.c$$
 
 exclude_file_name_regexp--sc_prohibit_strtol = \
   ^src/(util/virsexpr|(vbox|xen|xenxs)/.*)\.c$$
diff --git a/daemon/libvirtd-config.c b/daemon/libvirtd-config.c
index 5e3ae21..cc60098 100644
--- a/daemon/libvirtd-config.c
+++ b/daemon/libvirtd-config.c
@@ -23,15 +23,17 @@
 
 #include <config.h>
 
+#include "configmake.h"
 #include "libvirtd-config.h"
-#include "virconf.h"
+#include "remote/remote_driver.h"
+#include "remote/remote_protocol.h"
+#include "rpc/virnetserver.h"
 #include "viralloc.h"
+#include "virconf.h"
 #include "virerror.h"
 #include "virlog.h"
-#include "rpc/virnetserver.h"
-#include "configmake.h"
-#include "remote/remote_protocol.h"
-#include "remote/remote_driver.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_CONF
 
diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 34a8737..55f709e 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -43,18 +43,18 @@
 #include "libvirtd.h"
 #include "libvirtd-config.h"
 
-#include "virutil.h"
-#include "viruuid.h"
+#include "locking/lock_manager.h"
+#include "remote.h"
+#include "remote_driver.h"
 #include "remote_driver.h"
 #include "viralloc.h"
+#include "viraudit.h"
 #include "virconf.h"
+#include "virhook.h"
 #include "virnetlink.h"
 #include "virnetserver.h"
-#include "remote.h"
-#include "remote_driver.h"
-#include "virhook.h"
-#include "viraudit.h"
-#include "locking/lock_manager.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #ifdef WITH_DRIVER_MODULES
 # include "driver.h"
diff --git a/daemon/remote.c b/daemon/remote.c
index 45c50f3..52ccfed 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -29,29 +29,28 @@
 # include <polkit-dbus/polkit-dbus.h>
 #endif
 
-#include "remote.h"
-#include "libvirtd.h"
-#include "libvirt_internal.h"
 #include "datatypes.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "virutil.h"
-#include "stream.h"
-#include "viruuid.h"
-#include "libvirt/libvirt-qemu.h"
+#include "intprops.h"
 #include "libvirt/libvirt-lxc.h"
+#include "libvirt/libvirt-qemu.h"
+#include "libvirt_internal.h"
+#include "libvirtd.h"
+#include "lxc_protocol.h"
+#include "qemu_protocol.h"
+#include "remote.h"
+#include "remote_protocol.h"
+#include "stream.h"
+#include "viralloc.h"
 #include "vircommand.h"
-#include "intprops.h"
-#include "virnetserverservice.h"
-#include "virnetserver.h"
-#include "virfile.h"
-#include "virtypedparam.h"
 #include "virdbus.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virnetserver.h"
+#include "virnetserverservice.h"
 #include "virprocess.h"
-#include "remote_protocol.h"
-#include "qemu_protocol.h"
-#include "lxc_protocol.h"
-
+#include "virstring.h"
+#include "virtypedparam.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index f6573e1..5f9ae4b 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -20,13 +20,15 @@
 #define VIR_ENUM_SENTINELS
 
 #include <Python.h>
+
+#include "ignore-value.h"
+#include "libvirt.h"
 #include "libvirt/libvirt.h"
 #include "libvirt/virterror.h"
 #include "typewrappers.h"
-#include "libvirt.h"
 #include "viralloc.h"
+#include "virstring.h"
 #include "virtypedparam.h"
-#include "ignore-value.h"
 #include "virutil.h"
 
 #ifndef __CYGWIN__
diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
index d53d5a3..8e83254 100644
--- a/src/conf/capabilities.c
+++ b/src/conf/capabilities.c
@@ -28,7 +28,6 @@
 #include "capabilities.h"
 #include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "viruuid.h"
 #include "cpu_conf.h"
 #include "virerror.h"
diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index bdc5f1d..fd0cc04 100644
--- a/src/conf/cpu_conf.c
+++ b/src/conf/cpu_conf.c
@@ -23,12 +23,12 @@
 
 #include <config.h>
 
-#include "virerror.h"
-#include "viralloc.h"
-#include "virutil.h"
-#include "virbuffer.h"
 #include "cpu_conf.h"
 #include "domain_conf.h"
+#include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_CPU
 
diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h
index 23ea455..bff3d70 100644
--- a/src/conf/cpu_conf.h
+++ b/src/conf/cpu_conf.h
@@ -24,11 +24,11 @@
 #ifndef __VIR_CPU_CONF_H__
 # define __VIR_CPU_CONF_H__
 
-# include "virutil.h"
+# include "virarch.h"
+# include "virbitmap.h"
 # include "virbuffer.h"
+# include "virutil.h"
 # include "virxml.h"
-# include "virbitmap.h"
-# include "virarch.h"
 
 # define VIR_CPU_VENDOR_ID_LENGTH 12
 
diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c
index 099b1cb..4b62a6f 100644
--- a/src/conf/device_conf.c
+++ b/src/conf/device_conf.c
@@ -21,14 +21,15 @@
  */
 
 #include <config.h>
-#include "virerror.h"
+
 #include "datatypes.h"
+#include "device_conf.h"
 #include "viralloc.h"
-#include "virxml.h"
-#include "viruuid.h"
-#include "virutil.h"
 #include "virbuffer.h"
-#include "device_conf.h"
+#include "virerror.h"
+#include "virstring.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_DEVICE
 
diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h
index 52e4ac5..28d6270 100644
--- a/src/conf/device_conf.h
+++ b/src/conf/device_conf.h
@@ -28,9 +28,9 @@
 # include <libxml/xpath.h>
 
 # include "internal.h"
-# include "virutil.h"
-# include "virthread.h"
 # include "virbuffer.h"
+# include "virthread.h"
+# include "virutil.h"
 
 enum virDeviceAddressPciMulti {
     VIR_DEVICE_ADDRESS_PCI_MULTI_DEFAULT = 0,
diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c
index a776058..7d170ad 100644
--- a/src/conf/domain_audit.c
+++ b/src/conf/domain_audit.c
@@ -27,10 +27,11 @@
 #include <sys/types.h>
 
 #include "domain_audit.h"
+#include "viralloc.h"
 #include "viraudit.h"
-#include "viruuid.h"
 #include "virlog.h"
-#include "viralloc.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 /* Return nn:mm in hex for block and character devices, and NULL
  * for other file types, stat failure, or allocation failure.  */
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 371d80c..95344ba 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -29,28 +29,28 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "internal.h"
-#include "virerror.h"
+#include "count-one-bits.h"
 #include "datatypes.h"
+#include "device_conf.h"
 #include "domain_conf.h"
+#include "internal.h"
+#include "netdev_bandwidth_conf.h"
+#include "netdev_vlan_conf.h"
+#include "netdev_vport_profile_conf.h"
+#include "nwfilter_conf.h"
+#include "secret_conf.h"
 #include "snapshot_conf.h"
-#include "viralloc.h"
 #include "verify.h"
-#include "virxml.h"
-#include "viruuid.h"
-#include "virutil.h"
+#include "viralloc.h"
+#include "virbitmap.h"
 #include "virbuffer.h"
+#include "virerror.h"
+#include "virfile.h"
 #include "virlog.h"
-#include "nwfilter_conf.h"
 #include "virstoragefile.h"
-#include "virfile.h"
-#include "virbitmap.h"
-#include "count-one-bits.h"
-#include "secret_conf.h"
-#include "netdev_vport_profile_conf.h"
-#include "netdev_bandwidth_conf.h"
-#include "netdev_vlan_conf.h"
-#include "device_conf.h"
+#include "virstring.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_DOMAIN
 
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index edddf25..fb23e63 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -32,7 +32,6 @@
 # include "capabilities.h"
 # include "storage_encryption_conf.h"
 # include "cpu_conf.h"
-# include "virutil.h"
 # include "virthread.h"
 # include "virhash.h"
 # include "virsocketaddr.h"
diff --git a/src/conf/domain_nwfilter.h b/src/conf/domain_nwfilter.h
index 268a03b..b1ed481 100644
--- a/src/conf/domain_nwfilter.h
+++ b/src/conf/domain_nwfilter.h
@@ -23,6 +23,8 @@
 #ifndef DOMAIN_NWFILTER_H
 # define DOMAIN_NWFILTER_H
 
+# include "domain_conf.h"
+
 typedef int (*virDomainConfInstantiateNWFilter)(virConnectPtr conn,
                                                 const unsigned char *vmuuid,
                                                 virDomainNetDefPtr net);
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index 7ca9c86..fd3c292 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -30,7 +30,6 @@
 #include "viralloc.h"
 #include "virxml.h"
 #include "viruuid.h"
-#include "virutil.h"
 #include "virbuffer.h"
 
 #define VIR_FROM_THIS VIR_FROM_INTERFACE
diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h
index e636c35..b7c1690 100644
--- a/src/conf/interface_conf.h
+++ b/src/conf/interface_conf.h
@@ -29,8 +29,8 @@
 # include <libxml/xpath.h>
 
 # include "internal.h"
-# include "virutil.h"
 # include "virthread.h"
+# include "virutil.h"
 
 /* There is currently 3 types of interfaces */
 
diff --git a/src/conf/netdev_bandwidth_conf.c b/src/conf/netdev_bandwidth_conf.c
index b830cd0..f30ac70 100644
--- a/src/conf/netdev_bandwidth_conf.c
+++ b/src/conf/netdev_bandwidth_conf.c
@@ -22,11 +22,11 @@
 
 #include <config.h>
 
+#include "domain_conf.h"
 #include "netdev_bandwidth_conf.h"
-#include "virerror.h"
-#include "virutil.h"
 #include "viralloc.h"
-#include "domain_conf.h"
+#include "virerror.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/conf/netdev_vport_profile_conf.c b/src/conf/netdev_vport_profile_conf.c
index 47f51f9..32bcef9 100644
--- a/src/conf/netdev_vport_profile_conf.c
+++ b/src/conf/netdev_vport_profile_conf.c
@@ -23,8 +23,9 @@
 #include <config.h>
 
 #include "netdev_vport_profile_conf.h"
-#include "virerror.h"
 #include "viralloc.h"
+#include "virerror.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index c5535e6..2d2c523 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -31,19 +31,19 @@
 #include <string.h>
 #include <dirent.h>
 
-#include "virerror.h"
+#include "c-ctype.h"
 #include "datatypes.h"
-#include "network_conf.h"
-#include "netdev_vport_profile_conf.h"
 #include "netdev_bandwidth_conf.h"
 #include "netdev_vlan_conf.h"
+#include "netdev_vport_profile_conf.h"
+#include "network_conf.h"
 #include "viralloc.h"
-#include "virxml.h"
-#include "viruuid.h"
-#include "virutil.h"
 #include "virbuffer.h"
-#include "c-ctype.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virstring.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define MAX_BRIDGE_ID 256
 #define VIR_FROM_THIS VIR_FROM_NETWORK
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index b4d8cb3..ff40931 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -33,7 +33,6 @@
 #include "node_device_conf.h"
 #include "viralloc.h"
 #include "virxml.h"
-#include "virutil.h"
 #include "virbuffer.h"
 #include "viruuid.h"
 #include "virrandom.h"
diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index ca5ec72..ceb5fea 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -26,9 +26,9 @@
 # define __VIR_NODE_DEVICE_CONF_H__
 
 # include "internal.h"
-# include "virutil.h"
-# include "virthread.h"
 # include "virpci.h"
+# include "virthread.h"
+# include "virutil.h"
 
 # include <libxml/tree.h>
 
diff --git a/src/conf/nwfilter_conf.c b/src/conf/nwfilter_conf.c
index e63a04b..f8e7e5b 100644
--- a/src/conf/nwfilter_conf.c
+++ b/src/conf/nwfilter_conf.c
@@ -38,15 +38,16 @@
 
 #include "internal.h"
 
-#include "viruuid.h"
-#include "viralloc.h"
-#include "virerror.h"
+#include "c-ctype.h"
 #include "datatypes.h"
-#include "nwfilter_params.h"
-#include "nwfilter_conf.h"
 #include "domain_conf.h"
-#include "c-ctype.h"
+#include "nwfilter_conf.h"
+#include "nwfilter_params.h"
+#include "viralloc.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
diff --git a/src/conf/nwfilter_conf.h b/src/conf/nwfilter_conf.h
index 48998ec..5d04cff 100644
--- a/src/conf/nwfilter_conf.h
+++ b/src/conf/nwfilter_conf.h
@@ -28,7 +28,6 @@
 
 # include "internal.h"
 
-# include "virutil.h"
 # include "virhash.h"
 # include "virxml.h"
 # include "virbuffer.h"
diff --git a/src/conf/nwfilter_params.c b/src/conf/nwfilter_params.c
index 7aebc8d..4bf030a 100644
--- a/src/conf/nwfilter_params.c
+++ b/src/conf/nwfilter_params.c
@@ -25,12 +25,13 @@
 
 #include "internal.h"
 
-#include "viralloc.h"
-#include "virerror.h"
 #include "datatypes.h"
-#include "nwfilter_params.h"
 #include "domain_conf.h"
+#include "nwfilter_params.h"
+#include "viralloc.h"
+#include "virerror.h"
 #include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
 
diff --git a/src/conf/secret_conf.c b/src/conf/secret_conf.c
index 8842d9a..f7658e7 100644
--- a/src/conf/secret_conf.c
+++ b/src/conf/secret_conf.c
@@ -29,7 +29,6 @@
 #include "viralloc.h"
 #include "secret_conf.h"
 #include "virerror.h"
-#include "virutil.h"
 #include "virxml.h"
 #include "viruuid.h"
 
diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c
index 1154202..bd4f4d1 100644
--- a/src/conf/snapshot_conf.c
+++ b/src/conf/snapshot_conf.c
@@ -28,24 +28,24 @@
 #include <sys/time.h>
 #include <unistd.h>
 
-#include "internal.h"
-#include "virbitmap.h"
-#include "virbuffer.h"
 #include "count-one-bits.h"
 #include "datatypes.h"
 #include "domain_conf.h"
-#include "virlog.h"
-#include "viralloc.h"
+#include "internal.h"
 #include "netdev_bandwidth_conf.h"
 #include "netdev_vport_profile_conf.h"
 #include "nwfilter_conf.h"
 #include "secret_conf.h"
 #include "snapshot_conf.h"
+#include "viralloc.h"
+#include "virbitmap.h"
+#include "virbuffer.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
 #include "virstoragefile.h"
-#include "virutil.h"
+#include "virstring.h"
 #include "viruuid.h"
-#include "virfile.h"
-#include "virerror.h"
 #include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_DOMAIN_SNAPSHOT
diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 9134a22..adb71a0 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -38,12 +38,12 @@
 #include "storage_conf.h"
 #include "virstoragefile.h"
 
-#include "virxml.h"
-#include "viruuid.h"
-#include "virbuffer.h"
-#include "virutil.h"
 #include "viralloc.h"
+#include "virbuffer.h"
 #include "virfile.h"
+#include "virstring.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h
index ad16eca..f6e3535 100644
--- a/src/conf/storage_conf.h
+++ b/src/conf/storage_conf.h
@@ -25,7 +25,6 @@
 # define __VIR_STORAGE_CONF_H__
 
 # include "internal.h"
-# include "virutil.h"
 # include "storage_encryption_conf.h"
 # include "virthread.h"
 
diff --git a/src/conf/storage_encryption_conf.c b/src/conf/storage_encryption_conf.c
index 88dff1b..c710bbd 100644
--- a/src/conf/storage_encryption_conf.c
+++ b/src/conf/storage_encryption_conf.c
@@ -31,7 +31,6 @@
 #include "viralloc.h"
 #include "storage_conf.h"
 #include "storage_encryption_conf.h"
-#include "virutil.h"
 #include "virxml.h"
 #include "virerror.h"
 #include "viruuid.h"
diff --git a/src/conf/virchrdev.c b/src/conf/virchrdev.c
index 1802324..d9fb304 100644
--- a/src/conf/virchrdev.c
+++ b/src/conf/virchrdev.c
@@ -27,16 +27,17 @@
 #include <unistd.h>
 #include <sys/types.h>
 
-#include "virchrdev.h"
-#include "virhash.h"
 #include "fdstream.h"
 #include "internal.h"
-#include "virthread.h"
 #include "viralloc.h"
-#include "virpidfile.h"
-#include "virlog.h"
+#include "virchrdev.h"
 #include "virerror.h"
 #include "virfile.h"
+#include "virhash.h"
+#include "virlog.h"
+#include "virpidfile.h"
+#include "virstring.h"
+#include "virthread.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/cpu/cpu_map.h b/src/cpu/cpu_map.h
index 8d27bcd..13ab0eb 100644
--- a/src/cpu/cpu_map.h
+++ b/src/cpu/cpu_map.h
@@ -24,9 +24,9 @@
 #ifndef __VIR_CPU_MAP_H__
 # define __VIR_CPU_MAP_H__
 
+# include "virutil.h"
 # include "virxml.h"
 
-
 enum cpuMapElement {
     CPU_MAP_ELEMENT_VENDOR,
     CPU_MAP_ELEMENT_FEATURE,
diff --git a/src/cpu/cpu_powerpc.c b/src/cpu/cpu_powerpc.c
index 5e1a7b9..0c8520d 100644
--- a/src/cpu/cpu_powerpc.c
+++ b/src/cpu/cpu_powerpc.c
@@ -28,7 +28,6 @@
 
 #include "virlog.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "cpu.h"
 
 #include "cpu_map.h"
diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c
index c750afd..bfdcc0d 100644
--- a/src/cpu/cpu_x86.c
+++ b/src/cpu/cpu_x86.c
@@ -25,15 +25,14 @@
 
 #include <stdint.h>
 
-#include "virlog.h"
-#include "viralloc.h"
-#include "virutil.h"
 #include "cpu.h"
 #include "cpu_map.h"
 #include "cpu_x86.h"
+#include "viralloc.h"
 #include "virbuffer.h"
 #include "virendian.h"
-
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_CPU
 
diff --git a/src/datatypes.c b/src/datatypes.c
index b04e100..ffa9041 100644
--- a/src/datatypes.c
+++ b/src/datatypes.c
@@ -27,7 +27,6 @@
 #include "virlog.h"
 #include "viralloc.h"
 #include "viruuid.h"
-#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/driver.c b/src/driver.c
index 0a5fe05..652b22a 100644
--- a/src/driver.c
+++ b/src/driver.c
@@ -24,11 +24,11 @@
 
 #include <unistd.h>
 
+#include "configmake.h"
 #include "driver.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "virutil.h"
-#include "configmake.h"
+#include "virstring.h"
 
 #define DEFAULT_DRIVER_DIR LIBDIR "/libvirt/connection-driver"
 
diff --git a/src/esx/esx_device_monitor.c b/src/esx/esx_device_monitor.c
index f6c85ba..14f3b78 100644
--- a/src/esx/esx_device_monitor.c
+++ b/src/esx/esx_device_monitor.c
@@ -25,7 +25,6 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index fc8a3ae..c5e9848 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -24,28 +24,28 @@
 
 #include <config.h>
 
-#include "internal.h"
 #include "domain_conf.h"
-#include "snapshot_conf.h"
-#include "virauth.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "viruuid.h"
-#include "vmx.h"
-#include "virtypedparam.h"
+#include "esx_device_monitor.h"
 #include "esx_driver.h"
 #include "esx_interface_driver.h"
 #include "esx_network_driver.h"
-#include "esx_storage_driver.h"
-#include "esx_device_monitor.h"
-#include "esx_secret_driver.h"
 #include "esx_nwfilter_driver.h"
 #include "esx_private.h"
+#include "esx_secret_driver.h"
+#include "esx_storage_driver.h"
+#include "esx_util.h"
 #include "esx_vi.h"
 #include "esx_vi_methods.h"
-#include "esx_util.h"
+#include "internal.h"
+#include "snapshot_conf.h"
+#include "viralloc.h"
+#include "virauth.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virtypedparam.h"
 #include "viruri.h"
+#include "viruuid.h"
+#include "vmx.h"
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
diff --git a/src/esx/esx_interface_driver.c b/src/esx/esx_interface_driver.c
index 53c179b..40b0725 100644
--- a/src/esx/esx_interface_driver.c
+++ b/src/esx/esx_interface_driver.c
@@ -25,7 +25,6 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/esx/esx_network_driver.c b/src/esx/esx_network_driver.c
index 48763d4..e111358 100644
--- a/src/esx/esx_network_driver.c
+++ b/src/esx/esx_network_driver.c
@@ -26,7 +26,6 @@
 
 #include "md5.h"
 #include "internal.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/esx/esx_nwfilter_driver.c b/src/esx/esx_nwfilter_driver.c
index c59929c..63dca47 100644
--- a/src/esx/esx_nwfilter_driver.c
+++ b/src/esx/esx_nwfilter_driver.c
@@ -25,7 +25,6 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/esx/esx_secret_driver.c b/src/esx/esx_secret_driver.c
index 92cbb14..c8dd5f5 100644
--- a/src/esx/esx_secret_driver.c
+++ b/src/esx/esx_secret_driver.c
@@ -24,7 +24,6 @@
 #include <config.h>
 
 #include "internal.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/esx/esx_storage_backend_iscsi.c b/src/esx/esx_storage_backend_iscsi.c
index e09fa55..afa4664 100644
--- a/src/esx/esx_storage_backend_iscsi.c
+++ b/src/esx/esx_storage_backend_iscsi.c
@@ -28,7 +28,6 @@
 
 #include "internal.h"
 #include "md5.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
index f965b4f..70958c5 100644
--- a/src/esx/esx_storage_backend_vmfs.c
+++ b/src/esx/esx_storage_backend_vmfs.c
@@ -29,19 +29,19 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#include "esx_private.h"
+#include "esx_storage_backend_vmfs.h"
+#include "esx_util.h"
+#include "esx_vi.h"
+#include "esx_vi_methods.h"
 #include "internal.h"
 #include "md5.h"
-#include "virutil.h"
+#include "storage_conf.h"
 #include "viralloc.h"
 #include "virlog.h"
-#include "viruuid.h"
-#include "storage_conf.h"
 #include "virstoragefile.h"
-#include "esx_storage_backend_vmfs.h"
-#include "esx_private.h"
-#include "esx_vi.h"
-#include "esx_vi_methods.h"
-#include "esx_util.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
diff --git a/src/esx/esx_util.c b/src/esx/esx_util.c
index 4d2019b..67a9782 100644
--- a/src/esx/esx_util.c
+++ b/src/esx/esx_util.c
@@ -26,15 +26,15 @@
 
 #include <netdb.h>
 
-#include "internal.h"
 #include "datatypes.h"
-#include "virutil.h"
+#include "esx_private.h"
+#include "esx_util.h"
+#include "internal.h"
 #include "viralloc.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "viruuid.h"
 #include "vmx.h"
-#include "esx_private.h"
-#include "esx_util.h"
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index d84ce19..00cfff0 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -26,16 +26,16 @@
 #include <libxml/parser.h>
 #include <libxml/xpathInternals.h>
 
-#include "virbuffer.h"
+#include "esx_util.h"
+#include "esx_vi.h"
+#include "esx_vi_methods.h"
 #include "viralloc.h"
+#include "virbuffer.h"
 #include "virlog.h"
-#include "virutil.h"
+#include "virstring.h"
 #include "viruuid.h"
-#include "vmx.h"
 #include "virxml.h"
-#include "esx_vi.h"
-#include "esx_vi_methods.h"
-#include "esx_util.h"
+#include "vmx.h"
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c
index d1f91ff..4dc2b64 100644
--- a/src/esx/esx_vi_types.c
+++ b/src/esx/esx_vi_types.c
@@ -27,13 +27,13 @@
 #include <libxml/parser.h>
 #include <libxml/xpathInternals.h>
 
-#include "virbuffer.h"
 #include "datatypes.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "virutil.h"
 #include "esx_vi.h"
 #include "esx_vi_types.h"
+#include "viralloc.h"
+#include "virbuffer.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
diff --git a/src/fdstream.c b/src/fdstream.c
index 9a6f042..51903fe 100644
--- a/src/fdstream.c
+++ b/src/fdstream.c
@@ -32,14 +32,15 @@
 #endif
 #include <netinet/in.h>
 
+#include "configmake.h"
+#include "datatypes.h"
 #include "fdstream.h"
+#include "viralloc.h"
 #include "virerror.h"
-#include "datatypes.h"
+#include "virfile.h"
 #include "virlog.h"
-#include "viralloc.h"
+#include "virstring.h"
 #include "virutil.h"
-#include "virfile.h"
-#include "configmake.h"
 
 #define VIR_FROM_THIS VIR_FROM_STREAMS
 
diff --git a/src/hyperv/hyperv_device_monitor.c b/src/hyperv/hyperv_device_monitor.c
index 9432081..1102d04 100644
--- a/src/hyperv/hyperv_device_monitor.c
+++ b/src/hyperv/hyperv_device_monitor.c
@@ -26,7 +26,6 @@
 #include "internal.h"
 #include "virerror.h"
 #include "datatypes.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index 4644bff..3932741 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -23,25 +23,25 @@
 
 #include <config.h>
 
-#include "internal.h"
 #include "datatypes.h"
 #include "domain_conf.h"
-#include "virauth.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "viruuid.h"
+#include "hyperv_device_monitor.h"
 #include "hyperv_driver.h"
 #include "hyperv_interface_driver.h"
 #include "hyperv_network_driver.h"
-#include "hyperv_storage_driver.h"
-#include "hyperv_device_monitor.h"
-#include "hyperv_secret_driver.h"
 #include "hyperv_nwfilter_driver.h"
 #include "hyperv_private.h"
+#include "hyperv_secret_driver.h"
+#include "hyperv_storage_driver.h"
 #include "hyperv_util.h"
 #include "hyperv_wmi.h"
+#include "internal.h"
 #include "openwsman.h"
+#include "viralloc.h"
+#include "virauth.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_HYPERV
 
diff --git a/src/hyperv/hyperv_interface_driver.c b/src/hyperv/hyperv_interface_driver.c
index b42dbce..7cb333f 100644
--- a/src/hyperv/hyperv_interface_driver.c
+++ b/src/hyperv/hyperv_interface_driver.c
@@ -26,7 +26,6 @@
 #include "internal.h"
 #include "virerror.h"
 #include "datatypes.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/hyperv/hyperv_network_driver.c b/src/hyperv/hyperv_network_driver.c
index c75c943..e9012d7 100644
--- a/src/hyperv/hyperv_network_driver.c
+++ b/src/hyperv/hyperv_network_driver.c
@@ -26,7 +26,6 @@
 #include "internal.h"
 #include "virerror.h"
 #include "datatypes.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/hyperv/hyperv_nwfilter_driver.c b/src/hyperv/hyperv_nwfilter_driver.c
index faa9074..5e47bcd 100644
--- a/src/hyperv/hyperv_nwfilter_driver.c
+++ b/src/hyperv/hyperv_nwfilter_driver.c
@@ -26,7 +26,6 @@
 #include "internal.h"
 #include "virerror.h"
 #include "datatypes.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/hyperv/hyperv_secret_driver.c b/src/hyperv/hyperv_secret_driver.c
index 602ae99..214ed1c 100644
--- a/src/hyperv/hyperv_secret_driver.c
+++ b/src/hyperv/hyperv_secret_driver.c
@@ -26,7 +26,6 @@
 #include "internal.h"
 #include "virerror.h"
 #include "datatypes.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/hyperv/hyperv_storage_driver.c b/src/hyperv/hyperv_storage_driver.c
index a169b14..e9b9615 100644
--- a/src/hyperv/hyperv_storage_driver.c
+++ b/src/hyperv/hyperv_storage_driver.c
@@ -26,7 +26,6 @@
 #include "internal.h"
 #include "virerror.h"
 #include "datatypes.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/hyperv/hyperv_util.c b/src/hyperv/hyperv_util.c
index 9bc5b81..a55b939 100644
--- a/src/hyperv/hyperv_util.c
+++ b/src/hyperv/hyperv_util.c
@@ -24,7 +24,6 @@
 
 #include "internal.h"
 #include "datatypes.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "viruuid.h"
diff --git a/src/hyperv/hyperv_wmi.c b/src/hyperv/hyperv_wmi.c
index 33ba21f..a69b340 100644
--- a/src/hyperv/hyperv_wmi.c
+++ b/src/hyperv/hyperv_wmi.c
@@ -24,16 +24,16 @@
 
 #include <config.h>
 
+#include "datatypes.h"
+#include "hyperv_private.h"
+#include "hyperv_wmi.h"
 #include "internal.h"
+#include "viralloc.h"
+#include "virbuffer.h"
 #include "virerror.h"
-#include "datatypes.h"
 #include "virlog.h"
-#include "viralloc.h"
-#include "virutil.h"
+#include "virstring.h"
 #include "viruuid.h"
-#include "virbuffer.h"
-#include "hyperv_private.h"
-#include "hyperv_wmi.h"
 
 #define WS_SERIALIZER_FREE_MEM_WORKS 0
 
diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c
index 1132d9a..7788374 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -23,13 +23,14 @@
 #include <dirent.h>
 #include <libudev.h>
 
-#include "virerror.h"
 #include "c-ctype.h"
 #include "datatypes.h"
 #include "domain_conf.h"
-#include "interface_driver.h"
 #include "interface_conf.h"
+#include "interface_driver.h"
 #include "viralloc.h"
+#include "virerror.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_INTERFACE
 
diff --git a/src/libvirt.c b/src/libvirt.c
index 4b9ea75..821f48f 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -44,24 +44,25 @@
 # include <curl/curl.h>
 #endif
 
-#include "virerror.h"
-#include "virlog.h"
-#include "datatypes.h"
-#include "driver.h"
-
-#include "viruuid.h"
-#include "viralloc.h"
-#include "configmake.h"
-#include "intprops.h"
-#include "virconf.h"
 #if WITH_GNUTLS
 # include <gcrypt.h>
 # include "rpc/virnettlscontext.h"
 #endif
+
+#include "configmake.h"
+#include "datatypes.h"
+#include "driver.h"
+#include "intprops.h"
+#include "viralloc.h"
 #include "vircommand.h"
+#include "virconf.h"
+#include "virerror.h"
+#include "virlog.h"
 #include "virrandom.h"
-#include "viruri.h"
+#include "virstring.h"
 #include "virthread.h"
+#include "viruri.h"
+#include "viruuid.h"
 
 #ifdef WITH_TEST
 # include "test/test_driver.h"
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 96eea0a..71dd44c 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1722,9 +1722,25 @@ virStorageFileResize;
 
 
 # util/virstring.h
+virArgvToString;
+virAsprintf;
+virSkipSpaces;
+virSkipSpacesAndBackslash;
+virSkipSpacesBackwards;
+virStrcpy;
 virStringFreeList;
 virStringJoin;
 virStringSplit;
+virStrncpy;
+virStrToDouble;
+virStrToLong_i;
+virStrToLong_l;
+virStrToLong_ll;
+virStrToLong_ui;
+virStrToLong_ul;
+virStrToLong_ull;
+virTrimSpaces;
+virVasprintf;
 
 
 # util/virsysinfo.h
@@ -1817,8 +1833,6 @@ virUSBDeviceSetUsedBy;
 saferead;
 safewrite;
 safezero;
-virArgvToString;
-virAsprintf;
 virBuildPathInternal;
 virDirCreate;
 virDoubleToStr;
@@ -1883,22 +1897,8 @@ virSetInherit;
 virSetNonBlock;
 virSetUIDGID;
 virSetUIDGIDWithCaps;
-virSkipSpaces;
-virSkipSpacesAndBackslash;
-virSkipSpacesBackwards;
-virStrcpy;
 virStrIsPrint;
-virStrncpy;
-virStrToDouble;
-virStrToLong_i;
-virStrToLong_l;
-virStrToLong_ll;
-virStrToLong_ui;
-virStrToLong_ul;
-virStrToLong_ull;
-virTrimSpaces;
 virValidateWWN;
-virVasprintf;
 
 
 # util/viruuid.h
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 40a7a6b..2d23d08 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -30,21 +30,22 @@
 #include <libxl.h>
 #include <fcntl.h>
 
-#include "internal.h"
-#include "virlog.h"
-#include "virerror.h"
-#include "virconf.h"
 #include "datatypes.h"
-#include "virfile.h"
-#include "viralloc.h"
-#include "viruuid.h"
-#include "vircommand.h"
+#include "internal.h"
 #include "libxl.h"
-#include "libxl_driver.h"
 #include "libxl_conf.h"
-#include "xen_xm.h"
+#include "libxl_driver.h"
+#include "viralloc.h"
+#include "vircommand.h"
+#include "virconf.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 #include "virtypedparam.h"
 #include "viruri.h"
+#include "viruuid.h"
+#include "xen_xm.h"
 
 #define VIR_FROM_THIS VIR_FROM_LIBXL
 
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index 97e5d74..87c4651 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -33,17 +33,18 @@
 
 #include "lock_daemon.h"
 #include "lock_daemon_config.h"
-#include "virutil.h"
+#include "rpc/virnetserver.h"
+#include "viralloc.h"
+#include "virconf.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virhash.h"
+#include "virlog.h"
 #include "virpidfile.h"
 #include "virprocess.h"
-#include "virerror.h"
-#include "virlog.h"
-#include "viralloc.h"
-#include "virconf.h"
-#include "rpc/virnetserver.h"
 #include "virrandom.h"
-#include "virhash.h"
+#include "virstring.h"
+#include "virutil.h"
 #include "viruuid.h"
 
 #include "locking/lock_daemon_dispatch.h"
diff --git a/src/locking/lock_daemon_config.c b/src/locking/lock_daemon_config.c
index 12b06e2..aa747dc 100644
--- a/src/locking/lock_daemon_config.c
+++ b/src/locking/lock_daemon_config.c
@@ -23,13 +23,15 @@
 
 #include <config.h>
 
+#include "configmake.h"
 #include "lock_daemon_config.h"
-#include "virconf.h"
+#include "rpc/virnetserver.h"
 #include "viralloc.h"
+#include "virconf.h"
 #include "virerror.h"
 #include "virlog.h"
-#include "rpc/virnetserver.h"
-#include "configmake.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_CONF
 
diff --git a/src/locking/lock_daemon_dispatch.c b/src/locking/lock_daemon_dispatch.c
index 4c99088..8a92802 100644
--- a/src/locking/lock_daemon_dispatch.c
+++ b/src/locking/lock_daemon_dispatch.c
@@ -24,7 +24,6 @@
 
 #include "rpc/virnetserver.h"
 #include "rpc/virnetserverclient.h"
-#include "virutil.h"
 #include "virlog.h"
 
 #include "lock_daemon.h"
diff --git a/src/locking/lock_driver_lockd.c b/src/locking/lock_driver_lockd.c
index 4b72a05..236ccaf 100644
--- a/src/locking/lock_driver_lockd.c
+++ b/src/locking/lock_driver_lockd.c
@@ -21,18 +21,18 @@
 
 #include <config.h>
 
+#include "configmake.h"
 #include "lock_driver.h"
-#include "virconf.h"
+#include "lock_protocol.h"
+#include "rpc/virnetclient.h"
+#include "sha256.h"
 #include "viralloc.h"
+#include "virconf.h"
+#include "virerror.h"
+#include "virfile.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "viruuid.h"
-#include "virutil.h"
-#include "virfile.h"
-#include "virerror.h"
-#include "rpc/virnetclient.h"
-#include "lock_protocol.h"
-#include "configmake.h"
-#include "sha256.h"
 
 #define VIR_FROM_THIS VIR_FROM_LOCKING
 
diff --git a/src/locking/lock_driver_sanlock.c b/src/locking/lock_driver_sanlock.c
index 95f7d61..48c6d56 100644
--- a/src/locking/lock_driver_sanlock.c
+++ b/src/locking/lock_driver_sanlock.c
@@ -40,7 +40,6 @@
 #include "virlog.h"
 #include "virerror.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "virfile.h"
 #include "md5.h"
 #include "virconf.h"
diff --git a/src/locking/lock_manager.c b/src/locking/lock_manager.c
index ae60caf..37f2ab1 100644
--- a/src/locking/lock_manager.c
+++ b/src/locking/lock_manager.c
@@ -21,14 +21,6 @@
 
 #include <config.h>
 
-#include "lock_manager.h"
-#include "lock_driver_nop.h"
-#include "virerror.h"
-#include "virlog.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "viruuid.h"
-
 #if HAVE_DLFCN_H
 # include <dlfcn.h>
 #endif
@@ -36,6 +28,13 @@
 #include <unistd.h>
 
 #include "configmake.h"
+#include "lock_driver_nop.h"
+#include "lock_manager.h"
+#include "viralloc.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_LOCKING
 
diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c
index df468da..4a49454 100644
--- a/src/lxc/lxc_cgroup.c
+++ b/src/lxc/lxc_cgroup.c
@@ -23,11 +23,12 @@
 
 #include "lxc_cgroup.h"
 #include "lxc_container.h"
-#include "virfile.h"
-#include "virerror.h"
-#include "virlog.h"
 #include "viralloc.h"
 #include "vircgroup.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 002dba1..392d633 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -53,18 +53,18 @@
 # include <blkid/blkid.h>
 #endif
 
-#include "virerror.h"
-#include "virlog.h"
 #include "lxc_container.h"
-#include "virutil.h"
 #include "viralloc.h"
-#include "virnetdevveth.h"
-#include "viruuid.h"
-#include "virfile.h"
-#include "virusb.h"
 #include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
 #include "virnetdev.h"
+#include "virnetdevveth.h"
 #include "virprocess.h"
+#include "virstring.h"
+#include "virusb.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 1d1443c..8b07bd9 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -48,24 +48,24 @@
 
 #include "virerror.h"
 #include "virlog.h"
-#include "virutil.h"
 
+#include "lxc_cgroup.h"
 #include "lxc_conf.h"
 #include "lxc_container.h"
-#include "lxc_cgroup.h"
-#include "lxc_monitor_protocol.h"
 #include "lxc_fuse.h"
-#include "virnetdev.h"
-#include "virnetdevveth.h"
+#include "lxc_monitor_protocol.h"
+#include "nodeinfo.h"
+#include "rpc/virnetserver.h"
 #include "viralloc.h"
+#include "vircommand.h"
 #include "virfile.h"
+#include "virnetdev.h"
+#include "virnetdevveth.h"
+#include "virnuma.h"
 #include "virpidfile.h"
-#include "vircommand.h"
-#include "nodeinfo.h"
-#include "virrandom.h"
 #include "virprocess.h"
-#include "virnuma.h"
-#include "rpc/virnetserver.h"
+#include "virrandom.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index ba14db7..a030030 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -36,38 +36,38 @@
 #include <unistd.h>
 #include <wait.h>
 
-#include "virerror.h"
-#include "virlog.h"
 #include "datatypes.h"
+#include "domain_audit.h"
+#include "domain_nwfilter.h"
+#include "fdstream.h"
 #include "lxc_cgroup.h"
 #include "lxc_conf.h"
 #include "lxc_container.h"
 #include "lxc_domain.h"
 #include "lxc_driver.h"
 #include "lxc_process.h"
-#include "viralloc.h"
-#include "virutil.h"
-#include "virnetdevbridge.h"
-#include "virnetdevveth.h"
+#include "network/bridge_driver.h"
 #include "nodeinfo.h"
-#include "viruuid.h"
-#include "virstatslinux.h"
-#include "virhook.h"
-#include "virfile.h"
-#include "virpidfile.h"
-#include "fdstream.h"
-#include "domain_audit.h"
-#include "domain_nwfilter.h"
 #include "nwfilter_conf.h"
-#include "network/bridge_driver.h"
+#include "viralloc.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virhook.h"
 #include "virinitctl.h"
+#include "virlog.h"
 #include "virnetdev.h"
+#include "virnetdevbridge.h"
 #include "virnetdevtap.h"
+#include "virnetdevveth.h"
 #include "virnodesuspend.h"
+#include "virpidfile.h"
 #include "virprocess.h"
+#include "virstatslinux.h"
+#include "virstring.h"
 #include "virtime.h"
 #include "virtypedparam.h"
 #include "viruri.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/lxc/lxc_fuse.c b/src/lxc/lxc_fuse.c
index fbd0d56..9f6f3da 100644
--- a/src/lxc/lxc_fuse.c
+++ b/src/lxc/lxc_fuse.c
@@ -29,12 +29,13 @@
 #include <sys/mount.h>
 #include <mntent.h>
 
-#include "lxc_fuse.h"
 #include "lxc_cgroup.h"
+#include "lxc_fuse.h"
+#include "virbuffer.h"
 #include "virerror.h"
-#include "virlog.h"
 #include "virfile.h"
-#include "virbuffer.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/lxc/lxc_fuse.h b/src/lxc/lxc_fuse.h
index ccc9b92..a42c39a 100644
--- a/src/lxc/lxc_fuse.h
+++ b/src/lxc/lxc_fuse.h
@@ -32,7 +32,6 @@
 # endif
 
 # include "lxc_conf.h"
-# include "virutil.h"
 # include "viralloc.h"
 
 struct virLXCMeminfo {
diff --git a/src/lxc/lxc_monitor.c b/src/lxc/lxc_monitor.c
index 6d11eda..465748d 100644
--- a/src/lxc/lxc_monitor.c
+++ b/src/lxc/lxc_monitor.c
@@ -26,10 +26,11 @@
 
 #include "viralloc.h"
 
+#include "rpc/virnetclient.h"
 #include "virerror.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "virthread.h"
-#include "rpc/virnetclient.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c
index 39a6ea2..c7374bb 100644
--- a/src/lxc/lxc_process.c
+++ b/src/lxc/lxc_process.c
@@ -26,26 +26,27 @@
 #include <fcntl.h>
 #include <signal.h>
 
-#include "lxc_process.h"
-#include "lxc_domain.h"
-#include "lxc_container.h"
-#include "lxc_fuse.h"
 #include "datatypes.h"
-#include "virfile.h"
-#include "virpidfile.h"
-#include "virnetdev.h"
-#include "virnetdevveth.h"
-#include "virnetdevbridge.h"
-#include "virtime.h"
+#include "domain_audit.h"
 #include "domain_nwfilter.h"
+#include "lxc_container.h"
+#include "lxc_domain.h"
+#include "lxc_fuse.h"
+#include "lxc_hostdev.h"
+#include "lxc_process.h"
 #include "network/bridge_driver.h"
 #include "viralloc.h"
-#include "domain_audit.h"
-#include "virerror.h"
-#include "virlog.h"
 #include "vircommand.h"
-#include "lxc_hostdev.h"
+#include "virerror.h"
+#include "virfile.h"
 #include "virhook.h"
+#include "virlog.h"
+#include "virnetdev.h"
+#include "virnetdevbridge.h"
+#include "virnetdevveth.h"
+#include "virpidfile.h"
+#include "virstring.h"
+#include "virtime.h"
 
 #define VIR_FROM_THIS VIR_FROM_LXC
 
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index e8b314a..0b65e08 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -44,29 +44,29 @@
 #include <sys/ioctl.h>
 #include <net/if.h>
 
-#include "virerror.h"
-#include "datatypes.h"
 #include "bridge_driver.h"
-#include "network_conf.h"
+#include "configmake.h"
+#include "datatypes.h"
 #include "device_conf.h"
 #include "driver.h"
+#include "network_conf.h"
+#include "viralloc.h"
 #include "virbuffer.h"
-#include "virpidfile.h"
-#include "virutil.h"
 #include "vircommand.h"
-#include "viralloc.h"
-#include "viruuid.h"
+#include "virdbus.h"
+#include "virdnsmasq.h"
+#include "virerror.h"
+#include "virfile.h"
 #include "viriptables.h"
 #include "virlog.h"
-#include "virdnsmasq.h"
-#include "configmake.h"
 #include "virnetdev.h"
-#include "virpci.h"
 #include "virnetdevbridge.h"
 #include "virnetdevtap.h"
 #include "virnetdevvportprofile.h"
-#include "virdbus.h"
-#include "virfile.h"
+#include "virpci.h"
+#include "virpidfile.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #define NETWORK_PID_DIR LOCALSTATEDIR "/run/libvirt/network"
 #define NETWORK_STATE_DIR LOCALSTATEDIR "/lib/libvirt/network"
diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c
index 6be7a25..78b614b 100644
--- a/src/node_device/node_device_driver.c
+++ b/src/node_device/node_device_driver.c
@@ -36,7 +36,6 @@
 #include "node_device_conf.h"
 #include "node_device_hal.h"
 #include "node_device_driver.h"
-#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
 
diff --git a/src/node_device/node_device_linux_sysfs.c b/src/node_device/node_device_linux_sysfs.c
index fd91430..c14d484 100644
--- a/src/node_device/node_device_linux_sysfs.c
+++ b/src/node_device/node_device_linux_sysfs.c
@@ -28,10 +28,11 @@
 
 #include "node_device_driver.h"
 #include "node_device_hal.h"
-#include "virerror.h"
 #include "viralloc.h"
-#include "virlog.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
 
diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index cb11e5f..b0858c8 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -26,18 +26,18 @@
 #include <scsi/scsi.h>
 #include <c-ctype.h>
 
-#include "node_device_udev.h"
-#include "virerror.h"
+#include "datatypes.h"
+#include "driver.h"
 #include "node_device_conf.h"
 #include "node_device_driver.h"
-#include "driver.h"
-#include "datatypes.h"
-#include "virlog.h"
+#include "node_device_udev.h"
 #include "viralloc.h"
-#include "viruuid.h"
-#include "virutil.h"
 #include "virbuffer.h"
+#include "virerror.h"
+#include "virlog.h"
 #include "virpci.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_NODEDEV
 
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
index 415c2e5..1b1019e 100644
--- a/src/nodeinfo.c
+++ b/src/nodeinfo.c
@@ -44,19 +44,18 @@
 #endif
 
 #include "c-ctype.h"
-#include "viralloc.h"
-#include "nodeinfo.h"
-#include "physmem.h"
-#include "virutil.h"
-#include "virlog.h"
-#include "virerror.h"
 #include "count-one-bits.h"
 #include "intprops.h"
+#include "nodeinfo.h"
+#include "physmem.h"
+#include "viralloc.h"
 #include "virarch.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 #include "virtypedparam.h"
 
-
 #define VIR_FROM_THIS VIR_FROM_NONE
 
 #ifdef __FreeBSD__
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index 5124069..bda2f07 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -54,19 +54,20 @@
 #include <netinet/udp.h>
 #include <net/if.h>
 
-#include "viralloc.h"
-#include "virlog.h"
-#include "datatypes.h"
-#include "virerror.h"
 #include "conf/domain_conf.h"
-#include "nwfilter_gentech_driver.h"
+#include "configmake.h"
+#include "datatypes.h"
 #include "nwfilter_dhcpsnoop.h"
+#include "nwfilter_gentech_driver.h"
 #include "nwfilter_ipaddrmap.h"
-#include "virnetdev.h"
-#include "virfile.h"
+#include "viralloc.h"
 #include "viratomic.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virnetdev.h"
+#include "virstring.h"
 #include "virthreadpool.h"
-#include "configmake.h"
 #include "virtime.h"
 
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
diff --git a/src/nwfilter/nwfilter_dhcpsnoop.h b/src/nwfilter/nwfilter_dhcpsnoop.h
index d075f83..33a16c6 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.h
+++ b/src/nwfilter/nwfilter_dhcpsnoop.h
@@ -24,6 +24,8 @@
 #ifndef __NWFILTER_DHCPSNOOP_H
 # define __NWFILTER_DHCPSNOOP_H
 
+# include "nwfilter_conf.h"
+
 int virNWFilterDHCPSnoopInit(void);
 void virNWFilterDHCPSnoopShutdown(void);
 int virNWFilterDHCPSnoopReq(virNWFilterTechDriverPtr techdriver,
diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c
index 19ebb03..842ebd2 100644
--- a/src/nwfilter/nwfilter_driver.c
+++ b/src/nwfilter/nwfilter_driver.c
@@ -32,15 +32,16 @@
 
 #include "internal.h"
 
-#include "virerror.h"
+#include "configmake.h"
 #include "datatypes.h"
-#include "viralloc.h"
 #include "domain_conf.h"
 #include "domain_nwfilter.h"
 #include "nwfilter_conf.h"
 #include "nwfilter_driver.h"
 #include "nwfilter_gentech_driver.h"
-#include "configmake.h"
+#include "viralloc.h"
+#include "virerror.h"
+#include "virstring.h"
 
 #include "nwfilter_ipaddrmap.h"
 #include "nwfilter_dhcpsnoop.h"
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.c b/src/nwfilter/nwfilter_ebiptables_driver.c
index 0e39574..abc1f54 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.c
+++ b/src/nwfilter/nwfilter_ebiptables_driver.c
@@ -30,20 +30,20 @@
 
 #include "internal.h"
 
-#include "virbuffer.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "virerror.h"
+#include "configmake.h"
 #include "domain_conf.h"
+#include "intprops.h"
 #include "nwfilter_conf.h"
 #include "nwfilter_driver.h"
-#include "nwfilter_gentech_driver.h"
 #include "nwfilter_ebiptables_driver.h"
-#include "virfile.h"
+#include "nwfilter_gentech_driver.h"
+#include "viralloc.h"
+#include "virbuffer.h"
 #include "vircommand.h"
-#include "configmake.h"
-#include "intprops.h"
-
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
 
diff --git a/src/nwfilter/nwfilter_ebiptables_driver.h b/src/nwfilter/nwfilter_ebiptables_driver.h
index d909abb..57da41c 100644
--- a/src/nwfilter/nwfilter_ebiptables_driver.h
+++ b/src/nwfilter/nwfilter_ebiptables_driver.h
@@ -23,6 +23,8 @@
 #ifndef VIR_NWFILTER_EBTABLES_DRIVER_H__
 # define VIR_NWFILTER_EBTABLES_DRIVER_H__
 
+# include "nwfilter_conf.h"
+
 # define MAX_CHAINNAME_LENGTH  32 /* see linux/netfilter_bridge/ebtables.h */
 
 enum RuleType {
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 7a4f983..114d9f4 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -40,20 +40,21 @@
 
 #include "internal.h"
 
+#include "conf/domain_conf.h"
+#include "conf/nwfilter_params.h"
+#include "datatypes.h"
 #include "intprops.h"
-#include "virbuffer.h"
+#include "nwfilter_ebiptables_driver.h"
+#include "nwfilter_gentech_driver.h"
+#include "nwfilter_ipaddrmap.h"
+#include "nwfilter_learnipaddr.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
 #include "virlog.h"
-#include "datatypes.h"
 #include "virnetdev.h"
-#include "virerror.h"
+#include "virstring.h"
 #include "virthread.h"
-#include "conf/nwfilter_params.h"
-#include "conf/domain_conf.h"
-#include "nwfilter_gentech_driver.h"
-#include "nwfilter_ebiptables_driver.h"
-#include "nwfilter_ipaddrmap.h"
-#include "nwfilter_learnipaddr.h"
 
 #define VIR_FROM_THIS VIR_FROM_NWFILTER
 
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index f175655..c7afcfd 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -42,16 +42,16 @@
 #include <string.h>
 #include <sys/wait.h>
 
-#include "virerror.h"
+#include "nodeinfo.h"
 #include "openvz_conf.h"
 #include "openvz_util.h"
-#include "viruuid.h"
-#include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "nodeinfo.h"
-#include "virfile.h"
+#include "virbuffer.h"
 #include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_OPENVZ
 
diff --git a/src/openvz/openvz_driver.c b/src/openvz/openvz_driver.c
index 67d66ae..b12d41d 100644
--- a/src/openvz/openvz_driver.c
+++ b/src/openvz/openvz_driver.c
@@ -44,21 +44,21 @@
 #include <stdio.h>
 #include <sys/wait.h>
 
-#include "virerror.h"
 #include "datatypes.h"
+#include "nodeinfo.h"
+#include "openvz_conf.h"
 #include "openvz_driver.h"
 #include "openvz_util.h"
-#include "virbuffer.h"
-#include "virutil.h"
-#include "openvz_conf.h"
-#include "nodeinfo.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "vircommand.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "virtypedparam.h"
 #include "virlog.h"
-#include "vircommand.h"
-#include "viruri.h"
 #include "virstatslinux.h"
+#include "virstring.h"
+#include "virtypedparam.h"
+#include "viruri.h"
 
 #define VIR_FROM_THIS VIR_FROM_OPENVZ
 
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 88f41f7..b159416 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -40,16 +40,16 @@
 #include <sys/time.h>
 #include <sys/statvfs.h>
 
+#include "c-ctype.h"
+#include "configmake.h"
 #include "datatypes.h"
-#include "virerror.h"
+#include "nodeinfo.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virlog.h"
 #include "vircommand.h"
-#include "configmake.h"
+#include "virerror.h"
+#include "virlog.h"
 #include "virstoragefile.h"
-#include "nodeinfo.h"
-#include "c-ctype.h"
+#include "virstring.h"
 
 #include "parallels_driver.h"
 #include "parallels_utils.h"
diff --git a/src/parallels/parallels_network.c b/src/parallels/parallels_network.c
index c5ece79..2bfcea0 100644
--- a/src/parallels/parallels_network.c
+++ b/src/parallels/parallels_network.c
@@ -23,9 +23,10 @@
 #include <config.h>
 
 #include "datatypes.h"
+#include "md5.h"
 #include "viralloc.h"
 #include "virerror.h"
-#include "md5.h"
+#include "virstring.h"
 
 #include "parallels_utils.h"
 
diff --git a/src/parallels/parallels_storage.c b/src/parallels/parallels_storage.c
index ac65a1d..ee10a22 100644
--- a/src/parallels/parallels_storage.c
+++ b/src/parallels/parallels_storage.c
@@ -30,11 +30,12 @@
 #include <unistd.h>
 #include <libgen.h>
 
+#include "configmake.h"
 #include "datatypes.h"
 #include "viralloc.h"
-#include "configmake.h"
-#include "virstoragefile.h"
 #include "virerror.h"
+#include "virstoragefile.h"
+#include "virstring.h"
 
 #include "parallels_utils.h"
 
diff --git a/src/parallels/parallels_utils.c b/src/parallels/parallels_utils.c
index 0b589ab..08264ff 100644
--- a/src/parallels/parallels_utils.c
+++ b/src/parallels/parallels_utils.c
@@ -24,10 +24,11 @@
 
 #include <stdarg.h>
 
+#include "viralloc.h"
 #include "vircommand.h"
 #include "virerror.h"
-#include "viralloc.h"
 #include "virjson.h"
+#include "virstring.h"
 
 #include "parallels_utils.h"
 
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 59cc1ca..b8b9b8a 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -42,22 +42,22 @@
 #include <fcntl.h>
 #include <domain_event.h>
 
-#include "internal.h"
-#include "virauth.h"
-#include "virutil.h"
 #include "datatypes.h"
-#include "virbuffer.h"
-#include "viralloc.h"
-#include "virlog.h"
+#include "domain_conf.h"
 #include "driver.h"
+#include "interface_conf.h"
+#include "internal.h"
 #include "libvirt/libvirt.h"
-#include "virerror.h"
-#include "viruuid.h"
-#include "domain_conf.h"
-#include "storage_conf.h"
 #include "nodeinfo.h"
+#include "storage_conf.h"
+#include "viralloc.h"
+#include "virauth.h"
+#include "virbuffer.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "interface_conf.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #include "phyp_driver.h"
 
diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c
index 3e26cf1..bb5d51d 100644
--- a/src/qemu/qemu_agent.c
+++ b/src/qemu/qemu_agent.c
@@ -34,13 +34,14 @@
 
 #include "qemu_agent.h"
 #include "viralloc.h"
-#include "virlog.h"
 #include "virerror.h"
-#include "virjson.h"
 #include "virfile.h"
+#include "virjson.h"
+#include "virlog.h"
+#include "virobject.h"
 #include "virprocess.h"
+#include "virstring.h"
 #include "virtime.h"
-#include "virobject.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
diff --git a/src/qemu/qemu_bridge_filter.c b/src/qemu/qemu_bridge_filter.c
index 3bc1141..ab4db9a 100644
--- a/src/qemu/qemu_bridge_filter.c
+++ b/src/qemu/qemu_bridge_filter.c
@@ -25,7 +25,6 @@
 #include "virebtables.h"
 #include "qemu_conf.h"
 #include "qemu_driver.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "virlog.h"
 
diff --git a/src/qemu/qemu_bridge_filter.h b/src/qemu/qemu_bridge_filter.h
index ea8e0fa..7193cf1 100644
--- a/src/qemu/qemu_bridge_filter.h
+++ b/src/qemu/qemu_bridge_filter.h
@@ -23,6 +23,7 @@
 #ifndef __QEMUD_BRIDGE_FILTER_H__
 # define __QEMUD_BRIDGE_FILTER_H__
 
+# include "qemu_conf.h"
 
 int networkAllowMacOnPort(virQEMUDriverPtr driver,
                           const char * ifname,
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6b16191..a16450d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -23,21 +23,21 @@
 
 #include <config.h>
 
+#include "cpu/cpu.h"
+#include "domain_conf.h"
+#include "nodeinfo.h"
 #include "qemu_capabilities.h"
+#include "qemu_monitor.h"
 #include "viralloc.h"
-#include "virlog.h"
+#include "virbitmap.h"
+#include "vircommand.h"
 #include "virerror.h"
-#include "virutil.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virnodesuspend.h"
 #include "virpidfile.h"
 #include "virprocess.h"
-#include "nodeinfo.h"
-#include "cpu/cpu.h"
-#include "domain_conf.h"
-#include "vircommand.h"
-#include "virbitmap.h"
-#include "virnodesuspend.h"
-#include "qemu_monitor.h"
+#include "virstring.h"
 
 #include <fcntl.h>
 #include <sys/stat.h>
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index c9b4ca2..a791085 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -30,7 +30,6 @@
 #include "virlog.h"
 #include "viralloc.h"
 #include "virerror.h"
-#include "virutil.h"
 #include "domain_audit.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index c80218d..63b23e5 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -32,7 +32,6 @@
 #include "virlog.h"
 #include "virarch.h"
 #include "virerror.h"
-#include "virutil.h"
 #include "virfile.h"
 #include "virstring.h"
 #include "viruuid.h"
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index c2e2e10..86c4e6b 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -42,7 +42,6 @@
 #include "viruuid.h"
 #include "virbuffer.h"
 #include "virconf.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "datatypes.h"
 #include "virxml.h"
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c79b05d..ad8b811 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -23,20 +23,21 @@
 
 #include <config.h>
 
-#include "qemu_domain.h"
-#include "qemu_command.h"
+#include "c-ctype.h"
+#include "cpu/cpu.h"
+#include "domain_event.h"
 #include "qemu_capabilities.h"
+#include "qemu_command.h"
+#include "qemu_domain.h"
 #include "qemu_migration.h"
 #include "viralloc.h"
-#include "virlog.h"
 #include "virerror.h"
-#include "c-ctype.h"
-#include "cpu/cpu.h"
-#include "viruuid.h"
 #include "virfile.h"
-#include "domain_event.h"
-#include "virtime.h"
+#include "virlog.h"
 #include "virstoragefile.h"
+#include "virstring.h"
+#include "virtime.h"
+#include "viruuid.h"
 
 #include <sys/time.h>
 #include <fcntl.h>
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 96bf235..8b00491 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -58,41 +58,41 @@
 #include "qemu_process.h"
 #include "qemu_migration.h"
 
-#include "virerror.h"
-#include "virlog.h"
-#include "datatypes.h"
-#include "virbuffer.h"
-#include "virutil.h"
-#include "nodeinfo.h"
-#include "virstatslinux.h"
 #include "capabilities.h"
-#include "viralloc.h"
-#include "viruuid.h"
-#include "domain_conf.h"
-#include "domain_audit.h"
-#include "node_device_conf.h"
-#include "virpci.h"
-#include "virusb.h"
-#include "virprocess.h"
-#include "libvirt_internal.h"
-#include "virxml.h"
+#include "configmake.h"
 #include "cpu/cpu.h"
-#include "virsysinfo.h"
+#include "datatypes.h"
+#include "domain_audit.h"
+#include "domain_conf.h"
 #include "domain_nwfilter.h"
-#include "nwfilter_conf.h"
-#include "virhook.h"
-#include "virstoragefile.h"
-#include "virfile.h"
 #include "fdstream.h"
-#include "configmake.h"
-#include "virthreadpool.h"
-#include "locking/lock_manager.h"
+#include "libvirt_internal.h"
 #include "locking/domain_lock.h"
+#include "locking/lock_manager.h"
+#include "node_device_conf.h"
+#include "nodeinfo.h"
+#include "nwfilter_conf.h"
+#include "viralloc.h"
+#include "virbitmap.h"
+#include "virbuffer.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virhook.h"
 #include "virkeycode.h"
+#include "virlog.h"
 #include "virnodesuspend.h"
+#include "virpci.h"
+#include "virprocess.h"
+#include "virstatslinux.h"
+#include "virstoragefile.h"
+#include "virstring.h"
+#include "virsysinfo.h"
+#include "virthreadpool.h"
 #include "virtime.h"
 #include "virtypedparam.h"
-#include "virbitmap.h"
+#include "virusb.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index b978b97..b7d6eb3 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -24,28 +24,29 @@
 
 #include <config.h>
 
-#include "qemu_hotplug.h"
+#include "datatypes.h"
+#include "device_conf.h"
+#include "domain_audit.h"
+#include "domain_nwfilter.h"
+#include "locking/domain_lock.h"
+#include "network/bridge_driver.h"
+#include "qemu_bridge_filter.h"
 #include "qemu_capabilities.h"
-#include "qemu_domain.h"
+#include "qemu_cgroup.h"
 #include "qemu_command.h"
-#include "qemu_bridge_filter.h"
+#include "qemu_domain.h"
 #include "qemu_hostdev.h"
-#include "domain_audit.h"
-#include "domain_nwfilter.h"
-#include "virlog.h"
-#include "datatypes.h"
-#include "virerror.h"
+#include "qemu_hotplug.h"
 #include "viralloc.h"
-#include "virpci.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "qemu_cgroup.h"
-#include "locking/domain_lock.h"
-#include "network/bridge_driver.h"
+#include "virlog.h"
 #include "virnetdev.h"
 #include "virnetdevbridge.h"
 #include "virnetdevtap.h"
-#include "device_conf.h"
+#include "virpci.h"
 #include "virstoragefile.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 #define CHANGE_MEDIA_RETRIES 10
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3f74add..c02058b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1,4 +1,3 @@
-
 /*
  * qemu_migration.c: QEMU migration handling
  *
@@ -40,22 +39,21 @@
 #include "qemu_command.h"
 #include "qemu_cgroup.h"
 
-#include "domain_audit.h"
-#include "virlog.h"
-#include "virerror.h"
-#include "viralloc.h"
-#include "virutil.h"
-#include "virfile.h"
 #include "datatypes.h"
+#include "domain_audit.h"
 #include "fdstream.h"
-#include "viruuid.h"
-#include "virtime.h"
 #include "locking/domain_lock.h"
 #include "rpc/virnetsocket.h"
+#include "viralloc.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virhook.h"
+#include "virlog.h"
 #include "virstoragefile.h"
+#include "virstring.h"
+#include "virtime.h"
 #include "viruri.h"
-#include "virhook.h"
-
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 30f7820..7788ce4 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -29,14 +29,15 @@
 #include <fcntl.h>
 
 #include "qemu_monitor.h"
-#include "qemu_monitor_text.h"
 #include "qemu_monitor_json.h"
-#include "virerror.h"
+#include "qemu_monitor_text.h"
 #include "viralloc.h"
-#include "virlog.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "virprocess.h"
+#include "virlog.h"
 #include "virobject.h"
+#include "virprocess.h"
+#include "virstring.h"
 
 #ifdef WITH_DTRACE_PROBES
 # include "libvirt_qemu_probes.h"
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 1bf8baf..e3f06f1 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -31,16 +31,17 @@
 #include <string.h>
 #include <sys/time.h>
 
-#include "qemu_monitor_text.h"
-#include "qemu_monitor_json.h"
-#include "qemu_command.h"
+#include "datatypes.h"
+#include "driver.h"
 #include "qemu_capabilities.h"
+#include "qemu_command.h"
+#include "qemu_monitor_json.h"
+#include "qemu_monitor_text.h"
 #include "viralloc.h"
-#include "virlog.h"
-#include "driver.h"
-#include "datatypes.h"
 #include "virerror.h"
 #include "virjson.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #ifdef WITH_DTRACE_PROBES
 # include "libvirt_qemu_probes.h"
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index daade3d..f793025 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -30,16 +30,17 @@
 #include <unistd.h>
 #include <string.h>
 
-#include "qemu_monitor_text.h"
-#include "qemu_command.h"
 #include "c-ctype.h"
 #include "c-strcasestr.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "driver.h"
 #include "datatypes.h"
-#include "virerror.h"
+#include "driver.h"
+#include "qemu_command.h"
+#include "qemu_monitor_text.h"
+#include "viralloc.h"
 #include "virbuffer.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #ifdef WITH_DTRACE_PROBES
 # include "libvirt_qemu_probes.h"
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 8c4bfb7..47411bd 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -45,27 +45,27 @@
 #include "qemu_bridge_filter.h"
 #include "qemu_migration.h"
 
-#include "datatypes.h"
-#include "virlog.h"
-#include "virerror.h"
-#include "viralloc.h"
-#include "virhook.h"
-#include "virfile.h"
-#include "virpidfile.h"
-#include "virutil.h"
 #include "c-ctype.h"
-#include "nodeinfo.h"
+#include "datatypes.h"
 #include "domain_audit.h"
 #include "domain_nwfilter.h"
 #include "locking/domain_lock.h"
 #include "network/bridge_driver.h"
-#include "viruuid.h"
-#include "virprocess.h"
-#include "virtime.h"
-#include "virnetdevtap.h"
-#include "virbitmap.h"
+#include "nodeinfo.h"
+#include "viralloc.h"
 #include "viratomic.h"
+#include "virbitmap.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virhook.h"
+#include "virlog.h"
+#include "virnetdevtap.h"
 #include "virnuma.h"
+#include "virpidfile.h"
+#include "virprocess.h"
+#include "virstring.h"
+#include "virtime.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_QEMU
 
diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
index 885120e..e1cf16c 100644
--- a/src/remote/remote_driver.c
+++ b/src/remote/remote_driver.c
@@ -26,28 +26,28 @@
 #include <unistd.h>
 #include <assert.h>
 
-#include "virnetclient.h"
-#include "virnetclientprogram.h"
-#include "virnetclientstream.h"
-#include "virerror.h"
-#include "virlog.h"
 #include "datatypes.h"
 #include "domain_event.h"
 #include "driver.h"
-#include "virbuffer.h"
-#include "remote_driver.h"
-#include "remote_protocol.h"
+#include "intprops.h"
 #include "lxc_protocol.h"
 #include "qemu_protocol.h"
+#include "remote_driver.h"
+#include "remote_protocol.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virfile.h"
+#include "virauth.h"
+#include "virauthconfig.h"
+#include "virbuffer.h"
 #include "vircommand.h"
-#include "intprops.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virnetclient.h"
+#include "virnetclientprogram.h"
+#include "virnetclientstream.h"
+#include "virstring.h"
 #include "virtypedparam.h"
 #include "viruri.h"
-#include "virauth.h"
-#include "virauthconfig.h"
 
 #define VIR_FROM_THIS VIR_FROM_REMOTE
 
diff --git a/src/rpc/virkeepalive.c b/src/rpc/virkeepalive.c
index d49082c..8ae5c6c 100644
--- a/src/rpc/virkeepalive.c
+++ b/src/rpc/virkeepalive.c
@@ -26,7 +26,6 @@
 #include "virthread.h"
 #include "virfile.h"
 #include "virlog.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "virnetsocket.h"
 #include "virkeepaliveprotocol.h"
diff --git a/src/rpc/virnetclient.c b/src/rpc/virnetclient.c
index 010c5c3..99b3992 100644
--- a/src/rpc/virnetclient.c
+++ b/src/rpc/virnetclient.c
@@ -27,15 +27,15 @@
 #include <signal.h>
 #include <fcntl.h>
 
-#include "virnetclient.h"
-#include "virnetsocket.h"
-#include "virkeepalive.h"
 #include "viralloc.h"
-#include "virthread.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virkeepalive.h"
 #include "virlog.h"
+#include "virnetclient.h"
+#include "virnetsocket.h"
+#include "virthread.h"
 #include "virutil.h"
-#include "virerror.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/rpc/virnetclientprogram.c b/src/rpc/virnetclientprogram.c
index 2e6e4f6..ced6eda 100644
--- a/src/rpc/virnetclientprogram.c
+++ b/src/rpc/virnetclientprogram.c
@@ -30,10 +30,10 @@
 
 #include "viralloc.h"
 #include "virerror.h"
-#include "virlog.h"
-#include "virutil.h"
 #include "virfile.h"
+#include "virlog.h"
 #include "virthread.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c
index 647fef7..c37f58c 100644
--- a/src/rpc/virnetmessage.c
+++ b/src/rpc/virnetmessage.c
@@ -23,11 +23,11 @@
 #include <stdlib.h>
 #include <unistd.h>
 
-#include "virnetmessage.h"
 #include "viralloc.h"
 #include "virerror.h"
-#include "virlog.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virnetmessage.h"
 #include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index e536cc3..4717073 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -27,16 +27,16 @@
 #include <string.h>
 #include <fcntl.h>
 
-#include "virnetserver.h"
-#include "virlog.h"
 #include "viralloc.h"
+#include "virdbus.h"
 #include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virnetserver.h"
+#include "virnetservermdns.h"
 #include "virthread.h"
 #include "virthreadpool.h"
 #include "virutil.h"
-#include "virfile.h"
-#include "virnetservermdns.h"
-#include "virdbus.h"
 
 #ifndef SA_SIGINFO
 # define SA_SIGINFO 0
diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c
index 58fb0b4..b8f58a5 100644
--- a/src/rpc/virnetserverclient.c
+++ b/src/rpc/virnetserverclient.c
@@ -29,11 +29,13 @@
 
 #include "virnetserverclient.h"
 
-#include "virlog.h"
-#include "virerror.h"
 #include "viralloc.h"
-#include "virthread.h"
+#include "virerror.h"
 #include "virkeepalive.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index c4fd9ee..7318741 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -44,14 +44,15 @@
 # include <selinux/selinux.h>
 #endif
 
-#include "virnetsocket.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virerror.h"
-#include "virlog.h"
 #include "virfile.h"
-#include "virthread.h"
+#include "virlog.h"
+#include "virnetsocket.h"
 #include "virprocess.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virutil.h"
 
 #include "passfd.h"
 
diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c
index 9ce99f8..f22d026 100644
--- a/src/rpc/virnetsshsession.c
+++ b/src/rpc/virnetsshsession.c
@@ -25,15 +25,16 @@
 
 #include "virnetsshsession.h"
 
+#include "configmake.h"
 #include "internal.h"
-#include "virbuffer.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
 #include "virlog.h"
-#include "configmake.h"
+#include "virobject.h"
+#include "virstring.h"
 #include "virthread.h"
 #include "virutil.h"
-#include "virerror.h"
-#include "virobject.h"
 
 #define VIR_FROM_THIS VIR_FROM_SSH
 
diff --git a/src/rpc/virnettlscontext.c b/src/rpc/virnettlscontext.c
index eed0439..7adfc1b 100644
--- a/src/rpc/virnettlscontext.c
+++ b/src/rpc/virnettlscontext.c
@@ -30,12 +30,13 @@
 
 #include "virnettlscontext.h"
 
+#include "configmake.h"
 #include "viralloc.h"
 #include "virerror.h"
-#include "virutil.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "virthread.h"
-#include "configmake.h"
+#include "virutil.h"
 
 #define DH_BITS 1024
 
diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c
index c577817..863840b 100644
--- a/src/secret/secret_driver.c
+++ b/src/secret/secret_driver.c
@@ -28,20 +28,20 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "internal.h"
 #include "base64.h"
+#include "configmake.h"
 #include "datatypes.h"
 #include "driver.h"
-#include "virlog.h"
-#include "viralloc.h"
+#include "internal.h"
 #include "secret_conf.h"
 #include "secret_driver.h"
-#include "virthread.h"
-#include "virutil.h"
-#include "viruuid.h"
+#include "viralloc.h"
 #include "virerror.h"
 #include "virfile.h"
-#include "configmake.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECRET
 
diff --git a/src/security/security_apparmor.c b/src/security/security_apparmor.c
index 9dd8d74..983c7e6 100644
--- a/src/security/security_apparmor.c
+++ b/src/security/security_apparmor.c
@@ -37,18 +37,18 @@
 
 #include "internal.h"
 
+#include "configmake.h"
+#include "datatypes.h"
 #include "security_apparmor.h"
-#include "virutil.h"
 #include "viralloc.h"
+#include "vircommand.h"
 #include "virerror.h"
-#include "datatypes.h"
-#include "viruuid.h"
-#include "virpci.h"
-#include "virusb.h"
 #include "virfile.h"
-#include "configmake.h"
-#include "vircommand.h"
 #include "virlog.h"
+#include "virpci.h"
+#include "virstring.h"
+#include "virusb.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 #define SECURITY_APPARMOR_VOID_DOI      "0"
diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 35b90da..1464339 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -24,13 +24,13 @@
 #include <fcntl.h>
 
 #include "security_dac.h"
-#include "virerror.h"
-#include "virutil.h"
 #include "viralloc.h"
+#include "virerror.h"
 #include "virlog.h"
 #include "virpci.h"
-#include "virusb.h"
 #include "virstoragefile.h"
+#include "virstring.h"
+#include "virusb.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 #define SECURITY_DAC_NAME "dac"
diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c
index 60596ad..c52a0c2 100644
--- a/src/security/security_selinux.c
+++ b/src/security/security_selinux.c
@@ -33,18 +33,17 @@
 
 #include "security_driver.h"
 #include "security_selinux.h"
-#include "virerror.h"
-#include "virutil.h"
 #include "viralloc.h"
-#include "virlog.h"
-#include "virpci.h"
-#include "virusb.h"
-#include "virstoragefile.h"
+#include "virconf.h"
+#include "virerror.h"
 #include "virfile.h"
 #include "virhash.h"
+#include "virlog.h"
+#include "virpci.h"
 #include "virrandom.h"
-#include "virutil.h"
-#include "virconf.h"
+#include "virstoragefile.h"
+#include "virstring.h"
+#include "virusb.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index f764f77..af11ba8 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -41,20 +41,20 @@
 
 #include "internal.h"
 #include "virbuffer.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "vircommand.h"
 
-#include "security_driver.h"
-#include "security_apparmor.h"
+#include "configmake.h"
 #include "domain_conf.h"
-#include "virxml.h"
-#include "viruuid.h"
-#include "virusb.h"
-#include "virpci.h"
+#include "security_apparmor.h"
+#include "security_driver.h"
 #include "virfile.h"
-#include "configmake.h"
+#include "virpci.h"
 #include "virrandom.h"
+#include "virstring.h"
+#include "virusb.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_SECURITY
 
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index c4af48f..9b64ba5 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -41,9 +41,9 @@
 #include <unistd.h>
 #include <locale.h>
 
-#include "virutil.h"
 #include "c-ctype.h"
 #include "configmake.h"
+#include "virutil.h"
 
 /* we don't need to include the full internal.h just for this */
 #define STREQ(a,b) (strcmp(a,b) == 0)
diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index bb58d4a..03cfeeb 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -44,17 +44,17 @@
 #endif
 
 #include "datatypes.h"
-#include "virerror.h"
-#include "virutil.h"
-#include "viralloc.h"
 #include "internal.h"
 #include "secret_conf.h"
-#include "viruuid.h"
-#include "virstoragefile.h"
+#include "stat-time.h"
 #include "storage_backend.h"
-#include "virlog.h"
+#include "viralloc.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "stat-time.h"
+#include "virlog.h"
+#include "virstoragefile.h"
+#include "virstring.h"
+#include "viruuid.h"
 
 #if WITH_STORAGE_LVM
 # include "storage_backend_logical.h"
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 40da306..b627919 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -26,13 +26,13 @@
 #include <unistd.h>
 #include <stdio.h>
 
-#include "virerror.h"
-#include "virlog.h"
+#include "configmake.h"
 #include "storage_backend_disk.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "vircommand.h"
-#include "configmake.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index c1684f7..1ae3fab 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -41,15 +41,16 @@
 # include <blkid/blkid.h>
 #endif
 
-#include "virerror.h"
 #include "storage_backend_fs.h"
 #include "storage_conf.h"
-#include "virstoragefile.h"
-#include "vircommand.h"
 #include "viralloc.h"
-#include "virxml.h"
+#include "vircommand.h"
+#include "virerror.h"
 #include "virfile.h"
 #include "virlog.h"
+#include "virstoragefile.h"
+#include "virstring.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c
index f374961..6d92d8b 100644
--- a/src/storage/storage_backend_iscsi.c
+++ b/src/storage/storage_backend_iscsi.c
@@ -34,15 +34,15 @@
 #include <unistd.h>
 #include <sys/stat.h>
 
-#include "virerror.h"
-#include "storage_backend_scsi.h"
 #include "storage_backend_iscsi.h"
-#include "virutil.h"
+#include "storage_backend_scsi.h"
 #include "viralloc.h"
-#include "virlog.h"
-#include "virfile.h"
 #include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
 #include "virrandom.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 4cf6647..f4bf352 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -31,13 +31,14 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "virerror.h"
 #include "storage_backend_logical.h"
 #include "storage_conf.h"
-#include "vircommand.h"
 #include "viralloc.h"
-#include "virlog.h"
+#include "vircommand.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_backend_mpath.c b/src/storage/storage_backend_mpath.c
index b12b81f..80c4c1a 100644
--- a/src/storage/storage_backend_mpath.c
+++ b/src/storage/storage_backend_mpath.c
@@ -29,12 +29,13 @@
 
 #include <libdevmapper.h>
 
-#include "virerror.h"
-#include "storage_conf.h"
 #include "storage_backend.h"
+#include "storage_conf.h"
 #include "viralloc.h"
-#include "virlog.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c
index e815192..ca23d4b 100644
--- a/src/storage/storage_backend_rbd.c
+++ b/src/storage/storage_backend_rbd.c
@@ -26,7 +26,6 @@
 #include "virerror.h"
 #include "storage_backend_rbd.h"
 #include "storage_conf.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 #include "base64.h"
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 90bbf59..49d9b62 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -28,12 +28,13 @@
 #include <dirent.h>
 #include <fcntl.h>
 
-#include "virerror.h"
 #include "storage_backend_scsi.h"
 #include "viralloc.h"
-#include "virlog.h"
-#include "virfile.h"
 #include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/storage/storage_backend_sheepdog.c b/src/storage/storage_backend_sheepdog.c
index 35a3a04..cf7365f 100644
--- a/src/storage/storage_backend_sheepdog.c
+++ b/src/storage/storage_backend_sheepdog.c
@@ -30,7 +30,6 @@
 #include "storage_backend_sheepdog.h"
 #include "storage_conf.h"
 #include "vircommand.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virlog.h"
 
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index e98c18c..374bb4a 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -36,18 +36,18 @@
 #include <errno.h>
 #include <string.h>
 
-#include "virerror.h"
+#include "configmake.h"
 #include "datatypes.h"
 #include "driver.h"
-#include "virutil.h"
-#include "storage_driver.h"
+#include "fdstream.h"
+#include "storage_backend.h"
 #include "storage_conf.h"
+#include "storage_driver.h"
 #include "viralloc.h"
-#include "storage_backend.h"
-#include "virlog.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "fdstream.h"
-#include "configmake.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 4dbd775..e7d7d11 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -32,28 +32,28 @@
 #include <libxml/xmlsave.h>
 
 
-#include "virerror.h"
-#include "datatypes.h"
-#include "test_driver.h"
-#include "virbuffer.h"
-#include "virutil.h"
-#include "viruuid.h"
 #include "capabilities.h"
 #include "configmake.h"
-#include "viralloc.h"
-#include "network_conf.h"
-#include "interface_conf.h"
+#include "datatypes.h"
 #include "domain_conf.h"
 #include "domain_event.h"
 #include "fdstream.h"
-#include "storage_conf.h"
+#include "interface_conf.h"
+#include "network_conf.h"
 #include "node_device_conf.h"
-#include "virxml.h"
-#include "virthread.h"
-#include "virlog.h"
+#include "storage_conf.h"
+#include "test_driver.h"
+#include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "virtypedparam.h"
+#include "virlog.h"
 #include "virrandom.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virtypedparam.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_TEST
 
diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index b3ac326..61903d1 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -34,20 +34,19 @@
 #include <sys/wait.h>
 #include <arpa/inet.h>
 
+#include "domain_nwfilter.h"
+#include "nodeinfo.h"
 #include "uml_conf.h"
-#include "viruuid.h"
+#include "viralloc.h"
 #include "virbuffer.h"
+#include "vircommand.h"
 #include "virconf.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "nodeinfo.h"
-#include "virlog.h"
-#include "domain_nwfilter.h"
 #include "virfile.h"
-#include "vircommand.h"
+#include "virlog.h"
 #include "virnetdevtap.h"
 #include "virnodesuspend.h"
-
+#include "virstring.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_UML
 
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index 09a777c..14bd35f 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -44,28 +44,28 @@
 #include <sys/inotify.h>
 #include <sys/un.h>
 
-#include "uml_driver.h"
-#include "uml_conf.h"
-#include "virbuffer.h"
-#include "virutil.h"
-#include "nodeinfo.h"
-#include "virstatslinux.h"
 #include "capabilities.h"
-#include "viralloc.h"
-#include "viruuid.h"
-#include "domain_conf.h"
-#include "domain_audit.h"
+#include "configmake.h"
 #include "datatypes.h"
-#include "virlog.h"
+#include "domain_audit.h"
+#include "domain_conf.h"
 #include "domain_nwfilter.h"
+#include "fdstream.h"
+#include "nodeinfo.h"
 #include "nwfilter_conf.h"
+#include "uml_conf.h"
+#include "uml_driver.h"
+#include "viralloc.h"
+#include "virbuffer.h"
 #include "virfile.h"
-#include "fdstream.h"
-#include "configmake.h"
+#include "virlog.h"
 #include "virnetdevtap.h"
 #include "virnodesuspend.h"
 #include "virprocess.h"
+#include "virstatslinux.h"
+#include "virstring.h"
 #include "viruri.h"
+#include "viruuid.h"
 
 #define VIR_FROM_THIS VIR_FROM_UML
 
diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index 2230bcb..0e9b937 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -33,13 +33,14 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "virutil.h"
-#include "virthread.h"
-#include "virfile.h"
+#include "configmake.h"
 #include "viralloc.h"
 #include "virerror.h"
-#include "configmake.h"
+#include "virfile.h"
 #include "virrandom.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/util/viraudit.c b/src/util/viraudit.c
index 0f4bb4f..2588b21 100644
--- a/src/util/viraudit.c
+++ b/src/util/viraudit.c
@@ -27,12 +27,12 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "virerror.h"
-#include "virlog.h"
+#include "viralloc.h"
 #include "viraudit.h"
-#include "virutil.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "viralloc.h"
+#include "virlog.h"
+#include "virstring.h"
 
 /* Provide the macros in case the header file is old.
    FIXME: should be removed. */
diff --git a/src/util/virauth.c b/src/util/virauth.c
index c26e340..6563982 100644
--- a/src/util/virauth.c
+++ b/src/util/virauth.c
@@ -24,14 +24,15 @@
 
 #include <stdlib.h>
 
-#include "virauth.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "datatypes.h"
-#include "virerror.h"
 #include "configmake.h"
+#include "datatypes.h"
+#include "viralloc.h"
+#include "virauth.h"
 #include "virauthconfig.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_AUTH
 
diff --git a/src/util/virauthconfig.c b/src/util/virauthconfig.c
index 1d1f084..ef9a4f1 100644
--- a/src/util/virauthconfig.c
+++ b/src/util/virauthconfig.c
@@ -24,12 +24,11 @@
 
 #include "virauthconfig.h"
 
-#include "virkeyfile.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virlog.h"
 #include "virerror.h"
-
+#include "virkeyfile.h"
+#include "virlog.h"
+#include "virstring.h"
 
 struct _virAuthConfig {
     virKeyFilePtr keyfile;
diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 21509ac..196b983 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -30,12 +30,12 @@
 #include <stdlib.h>
 #include <sys/types.h>
 
-#include "virbitmap.h"
-#include "viralloc.h"
-#include "virbuffer.h"
-#include "virutil.h"
 #include "c-ctype.h"
 #include "count-one-bits.h"
+#include "viralloc.h"
+#include "virbitmap.h"
+#include "virbuffer.h"
+#include "virstring.h"
 
 
 struct _virBitmap {
diff --git a/src/util/vircgroup.c b/src/util/vircgroup.c
index 6998f13..4e7fbea 100644
--- a/src/util/vircgroup.c
+++ b/src/util/vircgroup.c
@@ -38,13 +38,13 @@
 #include <dirent.h>
 
 #include "internal.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "vircgroup.h"
-#include "virlog.h"
 #include "virfile.h"
 #include "virhash.h"
 #include "virhashcode.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define CGROUP_MAX_VAL 512
 
diff --git a/src/util/vircommand.c b/src/util/vircommand.c
index ac56a63..8956c3c 100644
--- a/src/util/vircommand.c
+++ b/src/util/vircommand.c
@@ -40,16 +40,17 @@
 # include <sys/apparmor.h>
 #endif
 
-#include "vircommand.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "vircommand.h"
 #include "virerror.h"
-#include "virutil.h"
-#include "virlog.h"
 #include "virfile.h"
+#include "virlog.h"
 #include "virpidfile.h"
 #include "virprocess.h"
-#include "virbuffer.h"
+#include "virstring.h"
 #include "virthread.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/vircommand.h b/src/util/vircommand.h
index 6c13795..79d1079 100644
--- a/src/util/vircommand.h
+++ b/src/util/vircommand.h
@@ -23,7 +23,6 @@
 # define __VIR_COMMAND_H__
 
 # include "internal.h"
-# include "virutil.h"
 # include "virbuffer.h"
 
 typedef struct _virCommand virCommand;
diff --git a/src/util/virconf.c b/src/util/virconf.c
index 16f074a..bb82440 100644
--- a/src/util/virconf.c
+++ b/src/util/virconf.c
@@ -30,14 +30,14 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "virerror.h"
-#include "virbuffer.h"
-#include "virconf.h"
-#include "virutil.h"
 #include "c-ctype.h"
-#include "virlog.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "virconf.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_CONF
 
diff --git a/src/util/virdnsmasq.c b/src/util/virdnsmasq.c
index 2e63d83..888d473 100644
--- a/src/util/virdnsmasq.c
+++ b/src/util/virdnsmasq.c
@@ -39,16 +39,17 @@
 # include <paths.h>
 #endif
 
-#include "internal.h"
 #include "datatypes.h"
+#include "internal.h"
+#include "viralloc.h"
 #include "virbitmap.h"
-#include "virdnsmasq.h"
-#include "virutil.h"
 #include "vircommand.h"
-#include "viralloc.h"
+#include "virdnsmasq.h"
 #include "virerror.h"
-#include "virlog.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NETWORK
 #define DNSMASQ_HOSTSFILE_SUFFIX "hostsfile"
diff --git a/src/util/virebtables.c b/src/util/virebtables.c
index ded62d7..421907b 100644
--- a/src/util/virebtables.c
+++ b/src/util/virebtables.c
@@ -42,12 +42,14 @@
 #endif
 
 #include "internal.h"
-#include "virebtables.h"
-#include "vircommand.h"
 #include "viralloc.h"
+#include "vircommand.h"
+#include "virebtables.h"
 #include "virerror.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "virthread.h"
+#include "virutil.h"
 
 #if HAVE_FIREWALLD
 static char *firewall_cmd_path = NULL;
diff --git a/src/util/virerror.c b/src/util/virerror.c
index c30642a..afb3c7a 100644
--- a/src/util/virerror.c
+++ b/src/util/virerror.c
@@ -27,10 +27,11 @@
 #include <string.h>
 #include <stdarg.h>
 
-#include "virerror.h"
 #include "datatypes.h"
-#include "virlog.h"
 #include "viralloc.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
 #include "virthread.h"
 #include "virutil.h"
 
diff --git a/src/util/vireventpoll.c b/src/util/vireventpoll.c
index 5c6d31b..996cb7b 100644
--- a/src/util/vireventpoll.c
+++ b/src/util/vireventpoll.c
@@ -31,14 +31,14 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#include "virthread.h"
-#include "virlog.h"
-#include "vireventpoll.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virfile.h"
 #include "virerror.h"
+#include "vireventpoll.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virthread.h"
 #include "virtime.h"
+#include "virutil.h"
 
 #define EVENT_DEBUG(fmt, ...) VIR_DEBUG(fmt, __VA_ARGS__)
 
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 4a9fa81..c32baf6 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -37,11 +37,12 @@
 # include <sys/ioctl.h>
 #endif
 
-#include "vircommand.h"
 #include "configmake.h"
 #include "viralloc.h"
+#include "vircommand.h"
 #include "virerror.h"
 #include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virhook.c b/src/util/virhook.c
index 097afba..e4b12ee 100644
--- a/src/util/virhook.c
+++ b/src/util/virhook.c
@@ -30,14 +30,14 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#include "configmake.h"
+#include "viralloc.h"
+#include "vircommand.h"
 #include "virerror.h"
+#include "virfile.h"
 #include "virhook.h"
-#include "virutil.h"
 #include "virlog.h"
-#include "viralloc.h"
-#include "virfile.h"
-#include "configmake.h"
-#include "vircommand.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_HOOK
 
diff --git a/src/util/virhook.h b/src/util/virhook.h
index a63a125..96bf4cf 100644
--- a/src/util/virhook.h
+++ b/src/util/virhook.h
@@ -25,7 +25,6 @@
 # define __VIR_HOOKS_H__
 
 # include "internal.h"
-# include "virutil.h"
 
 enum virHookDriverType {
     VIR_HOOK_DRIVER_DAEMON = 0,        /* Daemon related events */
diff --git a/src/util/virinitctl.c b/src/util/virinitctl.c
index 1618ffa..7d5370d 100644
--- a/src/util/virinitctl.c
+++ b/src/util/virinitctl.c
@@ -27,11 +27,12 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "virinitctl.h"
-#include "virerror.h"
-#include "virutil.h"
 #include "viralloc.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virinitctl.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_INITCTL
 
diff --git a/src/util/viriptables.c b/src/util/viriptables.c
index 19d6161..98e9974 100644
--- a/src/util/viriptables.c
+++ b/src/util/viriptables.c
@@ -40,12 +40,14 @@
 #endif
 
 #include "internal.h"
-#include "viriptables.h"
-#include "vircommand.h"
 #include "viralloc.h"
+#include "vircommand.h"
 #include "virerror.h"
+#include "viriptables.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "virthread.h"
+#include "virutil.h"
 
 #if HAVE_FIREWALLD
 static char *firewall_cmd_path = NULL;
diff --git a/src/util/virjson.c b/src/util/virjson.c
index e6a3b1b..5c0e8d7 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -23,10 +23,11 @@
 
 #include <config.h>
 
-#include "virjson.h"
 #include "viralloc.h"
 #include "virerror.h"
+#include "virjson.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "virutil.h"
 
 #if WITH_YAJL
diff --git a/src/util/virkeyfile.c b/src/util/virkeyfile.c
index d77e95d..38ed42e 100644
--- a/src/util/virkeyfile.c
+++ b/src/util/virkeyfile.c
@@ -26,12 +26,12 @@
 #include <stdio.h>
 
 #include "c-ctype.h"
-#include "virlog.h"
 #include "viralloc.h"
-#include "virutil.h"
+#include "virerror.h"
 #include "virhash.h"
 #include "virkeyfile.h"
-#include "virerror.h"
+#include "virlog.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_CONF
 
diff --git a/src/util/virlockspace.c b/src/util/virlockspace.c
index 4ff0f3a..5975efe 100644
--- a/src/util/virlockspace.c
+++ b/src/util/virlockspace.c
@@ -21,14 +21,15 @@
 
 #include <config.h>
 
-#include "virlockspace.h"
-#include "virlog.h"
 #include "viralloc.h"
 #include "virerror.h"
-#include "virutil.h"
 #include "virfile.h"
 #include "virhash.h"
+#include "virlockspace.h"
+#include "virlog.h"
+#include "virstring.h"
 #include "virthread.h"
+#include "virutil.h"
 
 #include <fcntl.h>
 #include <unistd.h>
diff --git a/src/util/virlog.c b/src/util/virlog.c
index 721c9bd..837fd74 100644
--- a/src/util/virlog.c
+++ b/src/util/virlog.c
@@ -41,15 +41,16 @@
 # include <sys/un.h>
 #endif
 
-#include "virerror.h"
-#include "virlog.h"
+#include "intprops.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "virbuffer.h"
-#include "virthread.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virthread.h"
 #include "virtime.h"
-#include "intprops.h"
+#include "virutil.h"
 
 /* Journald output is only supported on Linux new enough to expose
  * htole64.  */
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 00e0f94..773ae48 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -22,14 +22,16 @@
 
 #include <config.h>
 
-#include "virnetdev.h"
-#include "virmacaddr.h"
-#include "virfile.h"
-#include "virerror.h"
-#include "vircommand.h"
 #include "viralloc.h"
-#include "virpci.h"
+#include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
 #include "virlog.h"
+#include "virmacaddr.h"
+#include "virnetdev.h"
+#include "virpci.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #include <sys/ioctl.h>
 #include <net/if.h>
diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
index 2c5b63a..09a7ff1 100644
--- a/src/util/virnetdevbandwidth.c
+++ b/src/util/virnetdevbandwidth.c
@@ -22,10 +22,11 @@
 
 #include <config.h>
 
-#include "virnetdevbandwidth.h"
-#include "vircommand.h"
 #include "viralloc.h"
+#include "vircommand.h"
 #include "virerror.h"
+#include "virnetdevbandwidth.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c
index 9d46cc4..f4bc370 100644
--- a/src/util/virnetdevbridge.c
+++ b/src/util/virnetdevbridge.c
@@ -22,12 +22,13 @@
 
 #include <config.h>
 
-#include "virnetdevbridge.h"
+#include "intprops.h"
+#include "viralloc.h"
 #include "virerror.h"
-#include "virutil.h"
 #include "virfile.h"
-#include "viralloc.h"
-#include "intprops.h"
+#include "virnetdevbridge.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #include <sys/ioctl.h>
 #include <sys/socket.h>
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index ddea11f..67b63e8 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -29,7 +29,6 @@
 
 #include "virnetdevmacvlan.h"
 #include "virmacaddr.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "virthread.h"
 
diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 4fe077a..80f479b 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -23,11 +23,12 @@
 
 #include <config.h>
 
-#include "virnetdevopenvswitch.h"
-#include "vircommand.h"
 #include "viralloc.h"
+#include "vircommand.h"
 #include "virerror.h"
 #include "virmacaddr.h"
+#include "virnetdevopenvswitch.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virnetdevopenvswitch.h b/src/util/virnetdevopenvswitch.h
index 3216ea0..0852e4d 100644
--- a/src/util/virnetdevopenvswitch.h
+++ b/src/util/virnetdevopenvswitch.h
@@ -25,7 +25,6 @@
 # define __VIR_NETDEV_OPENVSWITCH_H__
 
 # include "internal.h"
-# include "virutil.h"
 # include "virnetdevvportprofile.h"
 # include "virnetdevvlan.h"
 
diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index a884de1..07ae8a6 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -22,17 +22,17 @@
 
 #include <config.h>
 
+#include "viralloc.h"
+#include "virerror.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
 #include "virmacaddr.h"
-#include "virnetdevtap.h"
 #include "virnetdev.h"
 #include "virnetdevbridge.h"
 #include "virnetdevopenvswitch.h"
-#include "virerror.h"
-#include "virfile.h"
-#include "virerror.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "virutil.h"
+#include "virnetdevtap.h"
+#include "virstring.h"
 
 #include <sys/ioctl.h>
 #include <net/if.h>
diff --git a/src/util/virnetdevveth.c b/src/util/virnetdevveth.c
index 3f81655..5ed1167 100644
--- a/src/util/virnetdevveth.c
+++ b/src/util/virnetdevveth.c
@@ -25,11 +25,13 @@
 
 #include <sys/wait.h>
 
-#include "virnetdevveth.h"
 #include "viralloc.h"
-#include "virlog.h"
 #include "vircommand.h"
 #include "virerror.h"
+#include "virlog.h"
+#include "virnetdevveth.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virnetdevvportprofile.c b/src/util/virnetdevvportprofile.c
index bb97e3a..312910a 100644
--- a/src/util/virnetdevvportprofile.c
+++ b/src/util/virnetdevvportprofile.c
@@ -22,9 +22,11 @@
 
 #include <config.h>
 
-#include "virnetdevvportprofile.h"
-#include "virerror.h"
 #include "viralloc.h"
+#include "virerror.h"
+#include "virnetdevvportprofile.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NET
 
diff --git a/src/util/virnetdevvportprofile.h b/src/util/virnetdevvportprofile.h
index 940c0e9..16685a0 100644
--- a/src/util/virnetdevvportprofile.h
+++ b/src/util/virnetdevvportprofile.h
@@ -24,9 +24,9 @@
 # define __VIR_NETDEV_VPORT_PROFILE_H__
 
 # include "internal.h"
-# include "viruuid.h"
-# include "virutil.h"
 # include "virmacaddr.h"
+# include "virutil.h"
+# include "viruuid.h"
 
 # define LIBVIRT_IFLA_VF_PORT_PROFILE_MAX 40
 
diff --git a/src/util/virpci.c b/src/util/virpci.c
index a0da1cd..757057f 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -36,11 +36,13 @@
 #include <unistd.h>
 #include <stdlib.h>
 
-#include "virlog.h"
 #include "viralloc.h"
 #include "vircommand.h"
 #include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define PCI_SYSFS "/sys/bus/pci/"
 #define PCI_ID_LEN 10   /* "XXXX XXXX" */
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 14c9f9f..60c4662 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -27,15 +27,16 @@
 #include <signal.h>
 #include <sys/stat.h>
 
-#include "virpidfile.h"
-#include "virfile.h"
-#include "viralloc.h"
-#include "virutil.h"
+#include "areadlink.h"
+#include "c-ctype.h"
 #include "intprops.h"
-#include "virlog.h"
+#include "viralloc.h"
 #include "virerror.h"
-#include "c-ctype.h"
-#include "areadlink.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virpidfile.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index a492bd1..c7b859d 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -23,18 +23,19 @@
 #include <config.h>
 
 #include <dirent.h>
+#include <errno.h>
 #include <fcntl.h>
+#include <sched.h>
 #include <signal.h>
-#include <errno.h>
 #include <sys/wait.h>
-#include <sched.h>
+#include <unistd.h>
 
-#include "virprocess.h"
-#include "virerror.h"
 #include "viralloc.h"
+#include "virerror.h"
 #include "virfile.h"
 #include "virlog.h"
-#include "virutil.h"
+#include "virprocess.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virrandom.c b/src/util/virrandom.c
index 6c5bc91..6734787 100644
--- a/src/util/virrandom.c
+++ b/src/util/virrandom.c
@@ -21,17 +21,18 @@
 
 #include <config.h>
 
-#include <stdlib.h>
 #include <inttypes.h>
 #include <math.h>
+#include <stdlib.h>
 #include <strings.h>
+#include <unistd.h>
 
-#include "virrandom.h"
-#include "virthread.h"
 #include "count-one-bits.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "virlog.h"
+#include "virrandom.h"
+#include "virstring.h"
+#include "virthread.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/virsexpr.c b/src/util/virsexpr.c
index 81dfbe6..1c9845f 100644
--- a/src/util/virsexpr.c
+++ b/src/util/virsexpr.c
@@ -28,10 +28,10 @@
 #include "c-ctype.h"
 #include <errno.h>
 
+#include "viralloc.h"
 #include "virerror.h"
 #include "virsexpr.h"
-#include "virutil.h"
-#include "viralloc.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_SEXPR
 
diff --git a/src/util/virsocketaddr.c b/src/util/virsocketaddr.c
index 3dfa3fb..afb2e5d 100644
--- a/src/util/virsocketaddr.c
+++ b/src/util/virsocketaddr.c
@@ -23,12 +23,12 @@
 
 #include <config.h>
 
-#include "virsocketaddr.h"
-#include "virerror.h"
-#include "virutil.h"
-
 #include <netdb.h>
 
+#include "virerror.h"
+#include "virsocketaddr.h"
+#include "virstring.h"
+
 #define VIR_FROM_THIS VIR_FROM_NONE
 
 /*
diff --git a/src/util/virstatslinux.c b/src/util/virstatslinux.c
index d3e1a02..60b72dc 100644
--- a/src/util/virstatslinux.c
+++ b/src/util/virstatslinux.c
@@ -34,7 +34,6 @@
 
 # include "virerror.h"
 # include "datatypes.h"
-# include "virutil.h"
 # include "virstatslinux.h"
 # include "viralloc.h"
 # include "virfile.h"
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index aabb5c8..90253b3 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -34,15 +34,16 @@
 # endif
 # include <sys/statfs.h>
 #endif
+#include "c-ctype.h"
 #include "dirname.h"
 #include "viralloc.h"
+#include "vircommand.h"
+#include "virendian.h"
 #include "virerror.h"
-#include "virlog.h"
 #include "virfile.h"
-#include "c-ctype.h"
-#include "vircommand.h"
 #include "virhash.h"
-#include "virendian.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/util/virstring.c b/src/util/virstring.c
index 0420ca3..5bcaf17 100644
--- a/src/util/virstring.c
+++ b/src/util/virstring.c
@@ -21,6 +21,10 @@
 
 #include <config.h>
 
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "c-ctype.h"
 #include "virstring.h"
 #include "viralloc.h"
 #include "virbuffer.h"
@@ -166,3 +170,334 @@ void virStringFreeList(char **strings)
     }
     VIR_FREE(strings);
 }
+
+/* Like strtol, but produce an "int" result, and check more carefully.
+   Return 0 upon success;  return -1 to indicate failure.
+   When END_PTR is NULL, the byte after the final valid digit must be NUL.
+   Otherwise, it's like strtol and lets the caller check any suffix for
+   validity.  This function is careful to return -1 when the string S
+   represents a number that is not representable as an "int". */
+int
+virStrToLong_i(char const *s, char **end_ptr, int base, int *result)
+{
+    long int val;
+    char *p;
+    int err;
+
+    errno = 0;
+    val = strtol(s, &p, base); /* exempt from syntax-check */
+    err = (errno || (!end_ptr && *p) || p == s || (int) val != val);
+    if (end_ptr)
+        *end_ptr = p;
+    if (err)
+        return -1;
+    *result = val;
+    return 0;
+}
+
+/* Just like virStrToLong_i, above, but produce an "unsigned int" value.  */
+int
+virStrToLong_ui(char const *s, char **end_ptr, int base, unsigned int *result)
+{
+    unsigned long int val;
+    char *p;
+    int err;
+
+    errno = 0;
+    val = strtoul(s, &p, base); /* exempt from syntax-check */
+    err = (errno || (!end_ptr && *p) || p == s || (unsigned int) val != val);
+    if (end_ptr)
+        *end_ptr = p;
+    if (err)
+        return -1;
+    *result = val;
+    return 0;
+}
+
+/* Just like virStrToLong_i, above, but produce a "long" value.  */
+int
+virStrToLong_l(char const *s, char **end_ptr, int base, long *result)
+{
+    long int val;
+    char *p;
+    int err;
+
+    errno = 0;
+    val = strtol(s, &p, base); /* exempt from syntax-check */
+    err = (errno || (!end_ptr && *p) || p == s);
+    if (end_ptr)
+        *end_ptr = p;
+    if (err)
+        return -1;
+    *result = val;
+    return 0;
+}
+
+/* Just like virStrToLong_i, above, but produce an "unsigned long" value.  */
+int
+virStrToLong_ul(char const *s, char **end_ptr, int base, unsigned long *result)
+{
+    unsigned long int val;
+    char *p;
+    int err;
+
+    errno = 0;
+    val = strtoul(s, &p, base); /* exempt from syntax-check */
+    err = (errno || (!end_ptr && *p) || p == s);
+    if (end_ptr)
+        *end_ptr = p;
+    if (err)
+        return -1;
+    *result = val;
+    return 0;
+}
+
+/* Just like virStrToLong_i, above, but produce a "long long" value.  */
+int
+virStrToLong_ll(char const *s, char **end_ptr, int base, long long *result)
+{
+    long long val;
+    char *p;
+    int err;
+
+    errno = 0;
+    val = strtoll(s, &p, base); /* exempt from syntax-check */
+    err = (errno || (!end_ptr && *p) || p == s);
+    if (end_ptr)
+        *end_ptr = p;
+    if (err)
+        return -1;
+    *result = val;
+    return 0;
+}
+
+/* Just like virStrToLong_i, above, but produce an "unsigned long long" value.  */
+int
+virStrToLong_ull(char const *s, char **end_ptr, int base, unsigned long long *result)
+{
+    unsigned long long val;
+    char *p;
+    int err;
+
+    errno = 0;
+    val = strtoull(s, &p, base); /* exempt from syntax-check */
+    err = (errno || (!end_ptr && *p) || p == s);
+    if (end_ptr)
+        *end_ptr = p;
+    if (err)
+        return -1;
+    *result = val;
+    return 0;
+}
+
+int
+virStrToDouble(char const *s,
+               char **end_ptr,
+               double *result)
+{
+    double val;
+    char *p;
+    int err;
+
+    errno = 0;
+    val = strtod(s, &p); /* exempt from syntax-check */
+    err = (errno || (!end_ptr && *p) || p == s);
+    if (end_ptr)
+        *end_ptr = p;
+    if (err)
+        return -1;
+    *result = val;
+    return 0;
+}
+
+/**
+ * virVasprintf
+ *
+ * like glibc's vasprintf but makes sure *strp == NULL on failure
+ */
+int
+virVasprintf(char **strp, const char *fmt, va_list list)
+{
+    int ret;
+
+    if ((ret = vasprintf(strp, fmt, list)) == -1)
+        *strp = NULL;
+
+    return ret;
+}
+
+/**
+ * virAsprintf
+ *
+ * like glibc's_asprintf but makes sure *strp == NULL on failure
+ */
+int
+virAsprintf(char **strp, const char *fmt, ...)
+{
+    va_list ap;
+    int ret;
+
+    va_start(ap, fmt);
+    ret = virVasprintf(strp, fmt, ap);
+    va_end(ap);
+    return ret;
+}
+
+/**
+ * virStrncpy
+ *
+ * A safe version of strncpy.  The last parameter is the number of bytes
+ * available in the destination string, *not* the number of bytes you want
+ * to copy.  If the destination is not large enough to hold all n of the
+ * src string bytes plus a \0, NULL is returned and no data is copied.
+ * If the destination is large enough to hold the n bytes plus \0, then the
+ * string is copied and a pointer to the destination string is returned.
+ */
+char *
+virStrncpy(char *dest, const char *src, size_t n, size_t destbytes)
+{
+    char *ret;
+
+    if (n > (destbytes - 1))
+        return NULL;
+
+    ret = strncpy(dest, src, n);
+    /* strncpy NULL terminates iff the last character is \0.  Therefore
+     * force the last byte to be \0
+     */
+    dest[n] = '\0';
+
+    return ret;
+}
+
+/**
+ * virStrcpy
+ *
+ * A safe version of strcpy.  The last parameter is the number of bytes
+ * available in the destination string, *not* the number of bytes you want
+ * to copy.  If the destination is not large enough to hold all n of the
+ * src string bytes plus a \0, NULL is returned and no data is copied.
+ * If the destination is large enough to hold the source plus \0, then the
+ * string is copied and a pointer to the destination string is returned.
+ */
+char *
+virStrcpy(char *dest, const char *src, size_t destbytes)
+{
+    return virStrncpy(dest, src, strlen(src), destbytes);
+}
+
+/**
+ * virSkipSpaces:
+ * @str: pointer to the char pointer used
+ *
+ * Skip potential blanks, this includes space tabs, line feed,
+ * carriage returns.
+ */
+void
+virSkipSpaces(const char **str)
+{
+    const char *cur = *str;
+
+    while (c_isspace(*cur))
+        cur++;
+    *str = cur;
+}
+
+/**
+ * virSkipSpacesAndBackslash:
+ * @str: pointer to the char pointer used
+ *
+ * Like virSkipSpaces, but also skip backslashes erroneously emitted
+ * by xend
+ */
+void
+virSkipSpacesAndBackslash(const char **str)
+{
+    const char *cur = *str;
+
+    while (c_isspace(*cur) || *cur == '\\')
+        cur++;
+    *str = cur;
+}
+
+/**
+ * virTrimSpaces:
+ * @str: string to modify to remove all trailing spaces
+ * @endp: track the end of the string
+ *
+ * If @endp is NULL on entry, then all spaces prior to the trailing
+ * NUL in @str are removed, by writing NUL into the appropriate
+ * location.  If @endp is non-NULL but points to a NULL pointer,
+ * then all spaces prior to the trailing NUL in @str are removed,
+ * NUL is written to the new string end, and endp is set to the
+ * location of the (new) string end.  If @endp is non-NULL and
+ * points to a non-NULL pointer, then that pointer is used as
+ * the end of the string, endp is set to the (new) location, but
+ * no NUL pointer is written into the string.
+ */
+void
+virTrimSpaces(char *str, char **endp)
+{
+    char *end;
+
+    if (!endp || !*endp)
+        end = str + strlen(str);
+    else
+        end = *endp;
+    while (end > str && c_isspace(end[-1]))
+        end--;
+    if (endp) {
+        if (!*endp)
+            *end = '\0';
+        *endp = end;
+    } else {
+        *end = '\0';
+    }
+}
+
+/**
+ * virSkipSpacesBackwards:
+ * @str: start of string
+ * @endp: on entry, *endp must be NULL or a location within @str, on exit,
+ * will be adjusted to skip trailing spaces, or to NULL if @str had nothing
+ * but spaces.
+ */
+void
+virSkipSpacesBackwards(const char *str, char **endp)
+{
+    /* Casting away const is safe, since virTrimSpaces does not
+     * modify string with this particular usage.  */
+    char *s = (char*) str;
+
+    if (!*endp)
+        *endp = s + strlen(s);
+    virTrimSpaces(s, endp);
+    if (s == *endp)
+        *endp = NULL;
+}
+
+char *
+virArgvToString(const char *const *argv)
+{
+    int len, i;
+    char *ret, *p;
+
+    for (len = 1, i = 0; argv[i]; i++)
+        len += strlen(argv[i]) + 1;
+
+    if (VIR_ALLOC_N(ret, len) < 0)
+        return NULL;
+    p = ret;
+
+    for (i = 0; argv[i]; i++) {
+        if (i != 0)
+            *(p++) = ' ';
+
+        strcpy(p, argv[i]);
+        p += strlen(argv[i]);
+    }
+
+    *p = '\0';
+
+    return ret;
+}
diff --git a/src/util/virstring.h b/src/util/virstring.h
index a569fe0..e90e689 100644
--- a/src/util/virstring.h
+++ b/src/util/virstring.h
@@ -23,6 +23,7 @@
 # define __VIR_STRING_H__
 
 # include "internal.h"
+# include <stdarg.h>
 
 char **virStringSplit(const char *string,
                       const char *delim,
@@ -35,4 +36,54 @@ char *virStringJoin(const char **strings,
 
 void virStringFreeList(char **strings);
 
+int virStrToLong_i(char const *s,
+                     char **end_ptr,
+                     int base,
+                     int *result);
+
+int virStrToLong_ui(char const *s,
+                    char **end_ptr,
+                    int base,
+                    unsigned int *result);
+int virStrToLong_l(char const *s,
+                   char **end_ptr,
+                   int base,
+                   long *result);
+int virStrToLong_ul(char const *s,
+                    char **end_ptr,
+                    int base,
+                    unsigned long *result);
+int virStrToLong_ll(char const *s,
+                    char **end_ptr,
+                    int base,
+                    long long *result);
+int virStrToLong_ull(char const *s,
+                     char **end_ptr,
+                     int base,
+                     unsigned long long *result);
+int virStrToDouble(char const *s,
+                   char **end_ptr,
+                   double *result);
+
+int virVasprintf(char **strp, const char *fmt, va_list list)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 0)
+    ATTRIBUTE_RETURN_CHECK;
+int virAsprintf(char **strp, const char *fmt, ...)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3)
+    ATTRIBUTE_RETURN_CHECK;
+char *virStrncpy(char *dest, const char *src, size_t n, size_t destbytes)
+    ATTRIBUTE_RETURN_CHECK;
+char *virStrcpy(char *dest, const char *src, size_t destbytes)
+    ATTRIBUTE_RETURN_CHECK;
+# define virStrcpyStatic(dest, src) virStrcpy((dest), (src), sizeof(dest))
+
+void virSkipSpaces(const char **str) ATTRIBUTE_NONNULL(1);
+void virSkipSpacesAndBackslash(const char **str) ATTRIBUTE_NONNULL(1);
+void virTrimSpaces(char *str, char **endp) ATTRIBUTE_NONNULL(1);
+void virSkipSpacesBackwards(const char *str, char **endp)
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
+
+char *virArgvToString(const char *const *argv);
+
+
 #endif /* __VIR_STRING_H__ */
diff --git a/src/util/virsysinfo.c b/src/util/virsysinfo.c
index 83c445d..385fb93 100644
--- a/src/util/virsysinfo.c
+++ b/src/util/virsysinfo.c
@@ -30,12 +30,12 @@
 #include <stdlib.h>
 #include <stdio.h>
 
-#include "virerror.h"
-#include "virsysinfo.h"
-#include "virutil.h"
-#include "virlog.h"
 #include "viralloc.h"
 #include "vircommand.h"
+#include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virsysinfo.h"
 
 #define VIR_FROM_THIS VIR_FROM_SYSINFO
 
diff --git a/src/util/virsysinfo.h b/src/util/virsysinfo.h
index fbb505b..74b1a92 100644
--- a/src/util/virsysinfo.h
+++ b/src/util/virsysinfo.h
@@ -25,8 +25,8 @@
 # define __VIR_SYSINFOS_H__
 
 # include "internal.h"
-# include "virutil.h"
 # include "virbuffer.h"
+# include "virutil.h"
 
 enum virSysinfoType {
     VIR_SYSINFO_SMBIOS,
diff --git a/src/util/virtime.c b/src/util/virtime.c
index b54a4e8..37c639c 100644
--- a/src/util/virtime.c
+++ b/src/util/virtime.c
@@ -37,7 +37,6 @@
 #include <sys/time.h>
 
 #include "virtime.h"
-#include "virutil.h"
 #include "viralloc.h"
 #include "virerror.h"
 
diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index c196321..8d8106e 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -25,8 +25,9 @@
 #include <stdarg.h>
 
 #include "viralloc.h"
-#include "virutil.h"
 #include "virerror.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/src/util/viruri.c b/src/util/viruri.c
index 2888cb0..1a9e0ba 100644
--- a/src/util/viruri.c
+++ b/src/util/viruri.c
@@ -23,9 +23,9 @@
 #include "viruri.h"
 
 #include "viralloc.h"
-#include "virutil.h"
-#include "virerror.h"
 #include "virbuffer.h"
+#include "virerror.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_URI
 
diff --git a/src/util/virusb.c b/src/util/virusb.c
index 5974602..02c4e69 100644
--- a/src/util/virusb.c
+++ b/src/util/virusb.c
@@ -33,11 +33,12 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "virusb.h"
-#include "virlog.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virusb.h"
+#include "virutil.h"
 
 #define USB_SYSFS "/sys/bus/usb"
 #define USB_ID_LEN 10 /* "1234 5678" */
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 87a97c9..82705c9 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -76,19 +76,19 @@
 
 #include "c-ctype.h"
 #include "dirname.h"
+#include "nonblocking.h"
+#include "passfd.h"
+#include "verify.h"
+#include "viralloc.h"
+#include "virbuffer.h"
+#include "vircommand.h"
 #include "virerror.h"
+#include "virfile.h"
 #include "virlog.h"
-#include "virbuffer.h"
-#include "virutil.h"
+#include "virprocess.h"
 #include "virstoragefile.h"
-#include "viralloc.h"
+#include "virstring.h"
 #include "virthread.h"
-#include "verify.h"
-#include "virfile.h"
-#include "vircommand.h"
-#include "nonblocking.h"
-#include "passfd.h"
-#include "virprocess.h"
 
 #ifndef NSIG
 # define NSIG 32
@@ -239,32 +239,6 @@ int virFileStripSuffix(char *str,
     return 1;
 }
 
-char *
-virArgvToString(const char *const *argv)
-{
-    int len, i;
-    char *ret, *p;
-
-    for (len = 1, i = 0; argv[i]; i++)
-        len += strlen(argv[i]) + 1;
-
-    if (VIR_ALLOC_N(ret, len) < 0)
-        return NULL;
-    p = ret;
-
-    for (i = 0; argv[i]; i++) {
-        if (i != 0)
-            *(p++) = ' ';
-
-        strcpy(p, argv[i]);
-        p += strlen(argv[i]);
-    }
-
-    *p = '\0';
-
-    return ret;
-}
-
 #ifndef WIN32
 
 int virSetInherit(int fd, bool inherit) {
@@ -1594,145 +1568,6 @@ virFileSanitizePath(const char *path)
     return cleanpath;
 }
 
-/* Like strtol, but produce an "int" result, and check more carefully.
-   Return 0 upon success;  return -1 to indicate failure.
-   When END_PTR is NULL, the byte after the final valid digit must be NUL.
-   Otherwise, it's like strtol and lets the caller check any suffix for
-   validity.  This function is careful to return -1 when the string S
-   represents a number that is not representable as an "int". */
-int
-virStrToLong_i(char const *s, char **end_ptr, int base, int *result)
-{
-    long int val;
-    char *p;
-    int err;
-
-    errno = 0;
-    val = strtol(s, &p, base); /* exempt from syntax-check */
-    err = (errno || (!end_ptr && *p) || p == s || (int) val != val);
-    if (end_ptr)
-        *end_ptr = p;
-    if (err)
-        return -1;
-    *result = val;
-    return 0;
-}
-
-/* Just like virStrToLong_i, above, but produce an "unsigned int" value.  */
-int
-virStrToLong_ui(char const *s, char **end_ptr, int base, unsigned int *result)
-{
-    unsigned long int val;
-    char *p;
-    int err;
-
-    errno = 0;
-    val = strtoul(s, &p, base); /* exempt from syntax-check */
-    err = (errno || (!end_ptr && *p) || p == s || (unsigned int) val != val);
-    if (end_ptr)
-        *end_ptr = p;
-    if (err)
-        return -1;
-    *result = val;
-    return 0;
-}
-
-/* Just like virStrToLong_i, above, but produce a "long" value.  */
-int
-virStrToLong_l(char const *s, char **end_ptr, int base, long *result)
-{
-    long int val;
-    char *p;
-    int err;
-
-    errno = 0;
-    val = strtol(s, &p, base); /* exempt from syntax-check */
-    err = (errno || (!end_ptr && *p) || p == s);
-    if (end_ptr)
-        *end_ptr = p;
-    if (err)
-        return -1;
-    *result = val;
-    return 0;
-}
-
-/* Just like virStrToLong_i, above, but produce an "unsigned long" value.  */
-int
-virStrToLong_ul(char const *s, char **end_ptr, int base, unsigned long *result)
-{
-    unsigned long int val;
-    char *p;
-    int err;
-
-    errno = 0;
-    val = strtoul(s, &p, base); /* exempt from syntax-check */
-    err = (errno || (!end_ptr && *p) || p == s);
-    if (end_ptr)
-        *end_ptr = p;
-    if (err)
-        return -1;
-    *result = val;
-    return 0;
-}
-
-/* Just like virStrToLong_i, above, but produce a "long long" value.  */
-int
-virStrToLong_ll(char const *s, char **end_ptr, int base, long long *result)
-{
-    long long val;
-    char *p;
-    int err;
-
-    errno = 0;
-    val = strtoll(s, &p, base); /* exempt from syntax-check */
-    err = (errno || (!end_ptr && *p) || p == s);
-    if (end_ptr)
-        *end_ptr = p;
-    if (err)
-        return -1;
-    *result = val;
-    return 0;
-}
-
-/* Just like virStrToLong_i, above, but produce an "unsigned long long" value.  */
-int
-virStrToLong_ull(char const *s, char **end_ptr, int base, unsigned long long *result)
-{
-    unsigned long long val;
-    char *p;
-    int err;
-
-    errno = 0;
-    val = strtoull(s, &p, base); /* exempt from syntax-check */
-    err = (errno || (!end_ptr && *p) || p == s);
-    if (end_ptr)
-        *end_ptr = p;
-    if (err)
-        return -1;
-    *result = val;
-    return 0;
-}
-
-int
-virStrToDouble(char const *s,
-               char **end_ptr,
-               double *result)
-{
-    double val;
-    char *p;
-    int err;
-
-    errno = 0;
-    val = strtod(s, &p); /* exempt from syntax-check */
-    err = (errno || (!end_ptr && *p) || p == s);
-    if (end_ptr)
-        *end_ptr = p;
-    if (err)
-        return -1;
-    *result = val;
-    return 0;
-}
-
 /* Convert C from hexadecimal character to integer.  */
 int
 virHexToBin(unsigned char c)
@@ -1819,96 +1654,6 @@ virScaleInteger(unsigned long long *value, const char *suffix,
 }
 
 /**
- * virSkipSpaces:
- * @str: pointer to the char pointer used
- *
- * Skip potential blanks, this includes space tabs, line feed,
- * carriage returns.
- */
-void
-virSkipSpaces(const char **str)
-{
-    const char *cur = *str;
-
-    while (c_isspace(*cur))
-        cur++;
-    *str = cur;
-}
-
-/**
- * virSkipSpacesAndBackslash:
- * @str: pointer to the char pointer used
- *
- * Like virSkipSpaces, but also skip backslashes erroneously emitted
- * by xend
- */
-void
-virSkipSpacesAndBackslash(const char **str)
-{
-    const char *cur = *str;
-
-    while (c_isspace(*cur) || *cur == '\\')
-        cur++;
-    *str = cur;
-}
-
-/**
- * virTrimSpaces:
- * @str: string to modify to remove all trailing spaces
- * @endp: track the end of the string
- *
- * If @endp is NULL on entry, then all spaces prior to the trailing
- * NUL in @str are removed, by writing NUL into the appropriate
- * location.  If @endp is non-NULL but points to a NULL pointer,
- * then all spaces prior to the trailing NUL in @str are removed,
- * NUL is written to the new string end, and endp is set to the
- * location of the (new) string end.  If @endp is non-NULL and
- * points to a non-NULL pointer, then that pointer is used as
- * the end of the string, endp is set to the (new) location, but
- * no NUL pointer is written into the string.
- */
-void
-virTrimSpaces(char *str, char **endp)
-{
-    char *end;
-
-    if (!endp || !*endp)
-        end = str + strlen(str);
-    else
-        end = *endp;
-    while (end > str && c_isspace(end[-1]))
-        end--;
-    if (endp) {
-        if (!*endp)
-            *end = '\0';
-        *endp = end;
-    } else {
-        *end = '\0';
-    }
-}
-
-/**
- * virSkipSpacesBackwards:
- * @str: start of string
- * @endp: on entry, *endp must be NULL or a location within @str, on exit,
- * will be adjusted to skip trailing spaces, or to NULL if @str had nothing
- * but spaces.
- */
-void
-virSkipSpacesBackwards(const char *str, char **endp)
-{
-    /* Casting away const is safe, since virTrimSpaces does not
-     * modify string with this particular usage.  */
-    char *s = (char*) str;
-
-    if (!*endp)
-        *endp = s + strlen(s);
-    virTrimSpaces(s, endp);
-    if (s == *endp)
-        *endp = NULL;
-}
-
-/**
  * virParseNumber:
  * @str: pointer to the char pointer used
  *
@@ -1939,7 +1684,6 @@ virParseNumber(const char **str)
     return ret;
 }
 
-
 /**
  * virParseVersionString:
  * @str: const char pointer to the version string
@@ -1986,82 +1730,6 @@ virParseVersionString(const char *str, unsigned long *version,
     return 0;
 }
 
-/**
- * virVasprintf
- *
- * like glibc's vasprintf but makes sure *strp == NULL on failure
- */
-int
-virVasprintf(char **strp, const char *fmt, va_list list)
-{
-    int ret;
-
-    if ((ret = vasprintf(strp, fmt, list)) == -1)
-        *strp = NULL;
-
-    return ret;
-}
-
-/**
- * virAsprintf
- *
- * like glibc's_asprintf but makes sure *strp == NULL on failure
- */
-int
-virAsprintf(char **strp, const char *fmt, ...)
-{
-    va_list ap;
-    int ret;
-
-    va_start(ap, fmt);
-    ret = virVasprintf(strp, fmt, ap);
-    va_end(ap);
-    return ret;
-}
-
-/**
- * virStrncpy
- *
- * A safe version of strncpy.  The last parameter is the number of bytes
- * available in the destination string, *not* the number of bytes you want
- * to copy.  If the destination is not large enough to hold all n of the
- * src string bytes plus a \0, NULL is returned and no data is copied.
- * If the destination is large enough to hold the n bytes plus \0, then the
- * string is copied and a pointer to the destination string is returned.
- */
-char *
-virStrncpy(char *dest, const char *src, size_t n, size_t destbytes)
-{
-    char *ret;
-
-    if (n > (destbytes - 1))
-        return NULL;
-
-    ret = strncpy(dest, src, n);
-    /* strncpy NULL terminates iff the last character is \0.  Therefore
-     * force the last byte to be \0
-     */
-    dest[n] = '\0';
-
-    return ret;
-}
-
-/**
- * virStrcpy
- *
- * A safe version of strcpy.  The last parameter is the number of bytes
- * available in the destination string, *not* the number of bytes you want
- * to copy.  If the destination is not large enough to hold all n of the
- * src string bytes plus a \0, NULL is returned and no data is copied.
- * If the destination is large enough to hold the source plus \0, then the
- * string is copied and a pointer to the destination string is returned.
- */
-char *
-virStrcpy(char *dest, const char *src, size_t destbytes)
-{
-    return virStrncpy(dest, src, strlen(src), destbytes);
-}
-
 int virEnumFromString(const char *const*types,
                       unsigned int ntypes,
                       const char *type)
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 2a797cb..f631da1 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -30,7 +30,7 @@
 # include <unistd.h>
 # include <sys/select.h>
 # include <sys/types.h>
-# include <stdarg.h>
+
 
 # ifndef MIN
 #  define MIN(a, b) ((a) < (b) ? (a) : (b))
@@ -155,63 +155,16 @@ int virFileOpenTty(int *ttymaster,
                    char **ttyName,
                    int rawmode);
 
-char *virArgvToString(const char *const *argv);
-
-int virStrToLong_i(char const *s,
-                     char **end_ptr,
-                     int base,
-                     int *result);
-
-int virStrToLong_ui(char const *s,
-                    char **end_ptr,
-                    int base,
-                    unsigned int *result);
-int virStrToLong_l(char const *s,
-                   char **end_ptr,
-                   int base,
-                   long *result);
-int virStrToLong_ul(char const *s,
-                    char **end_ptr,
-                    int base,
-                    unsigned long *result);
-int virStrToLong_ll(char const *s,
-                    char **end_ptr,
-                    int base,
-                    long long *result);
-int virStrToLong_ull(char const *s,
-                     char **end_ptr,
-                     int base,
-                     unsigned long long *result);
-int virStrToDouble(char const *s,
-                   char **end_ptr,
-                   double *result);
-
 int virScaleInteger(unsigned long long *value, const char *suffix,
                     unsigned long long scale, unsigned long long limit)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
 
 int virHexToBin(unsigned char c);
 
-void virSkipSpaces(const char **str) ATTRIBUTE_NONNULL(1);
-void virSkipSpacesAndBackslash(const char **str) ATTRIBUTE_NONNULL(1);
-void virTrimSpaces(char *str, char **endp) ATTRIBUTE_NONNULL(1);
-void virSkipSpacesBackwards(const char *str, char **endp)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 int virParseNumber(const char **str);
 int virParseVersionString(const char *str, unsigned long *version,
                           bool allowMissing);
-int virAsprintf(char **strp, const char *fmt, ...)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 3)
-    ATTRIBUTE_RETURN_CHECK;
-int virVasprintf(char **strp, const char *fmt, va_list list)
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_FMT_PRINTF(2, 0)
-    ATTRIBUTE_RETURN_CHECK;
-char *virStrncpy(char *dest, const char *src, size_t n, size_t destbytes)
-    ATTRIBUTE_RETURN_CHECK;
-char *virStrcpy(char *dest, const char *src, size_t destbytes)
-    ATTRIBUTE_RETURN_CHECK;
-# define virStrcpyStatic(dest, src) virStrcpy((dest), (src), sizeof(dest))
 
 int virDoubleToStr(char **strp, double number)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_RETURN_CHECK;
diff --git a/src/util/viruuid.c b/src/util/viruuid.c
index 7250543..a115b0a 100644
--- a/src/util/viruuid.c
+++ b/src/util/viruuid.c
@@ -37,12 +37,12 @@
 
 #include "c-ctype.h"
 #include "internal.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "virlog.h"
 #include "viralloc.h"
 #include "virfile.h"
 #include "virrandom.h"
+#include "virutil.h"
 
 #ifndef ENODATA
 # define ENODATA EIO
diff --git a/src/util/virxml.c b/src/util/virxml.c
index aa55a33..32e293e 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -30,12 +30,13 @@
 #include <math.h>               /* for isnan() */
 #include <sys/stat.h>
 
-#include "virerror.h"
-#include "virxml.h"
-#include "virbuffer.h"
-#include "virutil.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virstring.h"
+#include "virutil.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_XML
 
diff --git a/src/vbox/vbox_MSCOMGlue.c b/src/vbox/vbox_MSCOMGlue.c
index b5fb821..6cebfaf 100644
--- a/src/vbox/vbox_MSCOMGlue.c
+++ b/src/vbox/vbox_MSCOMGlue.c
@@ -31,7 +31,6 @@
 
 #include "internal.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "virlog.h"
 #include "virerror.h"
 #include "vbox_MSCOMGlue.h"
diff --git a/src/vbox/vbox_XPCOMCGlue.c b/src/vbox/vbox_XPCOMCGlue.c
index 2b568e2..e2e8126 100644
--- a/src/vbox/vbox_XPCOMCGlue.c
+++ b/src/vbox/vbox_XPCOMCGlue.c
@@ -35,12 +35,13 @@
 #include <stdlib.h>
 #include <dlfcn.h>
 
-#include "vbox_XPCOMCGlue.h"
 #include "internal.h"
+#include "vbox_XPCOMCGlue.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virlog.h"
 #include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_VBOX
 
diff --git a/src/vbox/vbox_driver.c b/src/vbox/vbox_driver.c
index 736c895..64bcf47 100644
--- a/src/vbox/vbox_driver.c
+++ b/src/vbox/vbox_driver.c
@@ -38,7 +38,6 @@
 #include "vbox_driver.h"
 #include "vbox_glue.h"
 #include "virerror.h"
-#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_VBOX
 
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index aa7466b..ea3c611 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -39,24 +39,25 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "internal.h"
+#include "configmake.h"
 #include "datatypes.h"
 #include "domain_conf.h"
-#include "snapshot_conf.h"
-#include "network_conf.h"
-#include "virerror.h"
 #include "domain_event.h"
-#include "storage_conf.h"
-#include "virstoragefile.h"
-#include "viruuid.h"
-#include "viralloc.h"
+#include "fdstream.h"
+#include "internal.h"
+#include "network_conf.h"
 #include "nodeinfo.h"
-#include "virlog.h"
+#include "snapshot_conf.h"
+#include "storage_conf.h"
 #include "vbox_driver.h"
-#include "configmake.h"
+#include "viralloc.h"
+#include "virerror.h"
 #include "virfile.h"
-#include "fdstream.h"
+#include "virlog.h"
+#include "virstoragefile.h"
+#include "virstring.h"
 #include "viruri.h"
+#include "viruuid.h"
 
 /* This one changes from version to version. */
 #if VBOX_API_VERSION == 2002
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index 19be62a..a291a84 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -23,14 +23,15 @@
 
 #include <string.h>
 
-#include "vircommand.h"
 #include "cpu/cpu.h"
 #include "dirname.h"
-#include "viralloc.h"
 #include "nodeinfo.h"
+#include "viralloc.h"
+#include "vircommand.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virstring.h"
 #include "viruuid.h"
-#include "virerror.h"
 #include "vmx.h"
 
 #include "vmware_conf.h"
diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 6d82532..bc00ea1 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -28,7 +28,6 @@
 #include "datatypes.h"
 #include "virfile.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "viruuid.h"
 #include "vircommand.h"
 #include "vmx.h"
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index d7eee09..3770d51 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -26,13 +26,14 @@
 #include <c-ctype.h>
 
 #include "internal.h"
-#include "virerror.h"
-#include "virconf.h"
 #include "viralloc.h"
+#include "virconf.h"
+#include "virerror.h"
 #include "virlog.h"
+#include "virstring.h"
+#include "viruri.h"
 #include "viruuid.h"
 #include "vmx.h"
-#include "viruri.h"
 
 /*
 
diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
index 9f5823c..df9785e 100644
--- a/src/xen/block_stats.c
+++ b/src/xen/block_stats.c
@@ -38,12 +38,12 @@
 #  include <xs.h>
 # endif
 
-# include "virerror.h"
-# include "datatypes.h"
-# include "virutil.h"
 # include "block_stats.h"
+# include "datatypes.h"
 # include "viralloc.h"
+# include "virerror.h"
 # include "virfile.h"
+# include "virstring.h"
 
 # define VIR_FROM_THIS VIR_FROM_STATS_LINUX
 
diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
index fd20b73..04f7cd3 100644
--- a/src/xen/xen_driver.c
+++ b/src/xen/xen_driver.c
@@ -53,19 +53,19 @@
 #if WITH_XEN_INOTIFY
 # include "xen_inotify.h"
 #endif
-#include "virxml.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "node_device_conf.h"
-#include "virpci.h"
-#include "viruuid.h"
+#include "configmake.h"
 #include "fdstream.h"
-#include "virfile.h"
-#include "viruri.h"
+#include "node_device_conf.h"
+#include "nodeinfo.h"
+#include "viralloc.h"
 #include "vircommand.h"
+#include "virfile.h"
 #include "virnodesuspend.h"
-#include "nodeinfo.h"
-#include "configmake.h"
+#include "virpci.h"
+#include "virstring.h"
+#include "viruri.h"
+#include "viruuid.h"
+#include "virxml.h"
 
 #define VIR_FROM_THIS VIR_FROM_XEN
 #define XEN_SAVE_DIR LOCALSTATEDIR "/lib/libvirt/xen/save"
diff --git a/src/xen/xen_hypervisor.c b/src/xen/xen_hypervisor.c
index d803972..c2880d3 100644
--- a/src/xen/xen_hypervisor.c
+++ b/src/xen/xen_hypervisor.c
@@ -62,25 +62,25 @@
 /* required for shutdown flags */
 #include <xen/sched.h>
 
-#include "virerror.h"
-#include "virlog.h"
-#include "datatypes.h"
-#include "driver.h"
-#include "virutil.h"
-#include "xen_driver.h"
-#include "xen_hypervisor.h"
-#include "xs_internal.h"
-#include "virstatslinux.h"
 #include "block_stats.h"
-#include "xend_internal.h"
-#include "virbuffer.h"
 #include "capabilities.h"
+#include "datatypes.h"
+#include "driver.h"
 #include "viralloc.h"
-#include "virthread.h"
+#include "virbuffer.h"
+#include "virendian.h"
+#include "virerror.h"
 #include "virfile.h"
+#include "virlog.h"
 #include "virnodesuspend.h"
+#include "virstatslinux.h"
+#include "virstring.h"
+#include "virthread.h"
 #include "virtypedparam.h"
-#include "virendian.h"
+#include "xen_driver.h"
+#include "xen_hypervisor.h"
+#include "xend_internal.h"
+#include "xs_internal.h"
 
 #define VIR_FROM_THIS VIR_FROM_XEN
 
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 398da0d..c8f13d4 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -29,24 +29,24 @@
 #include <netdb.h>
 #include <errno.h>
 
-#include "virerror.h"
-#include "virlog.h"
+#include "count-one-bits.h"
 #include "datatypes.h"
-#include "xend_internal.h"
+#include "device_conf.h"
 #include "driver.h"
-#include "virutil.h"
-#include "virsexpr.h"
-#include "xen_sxpr.h"
+#include "viralloc.h"
 #include "virbuffer.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
+#include "virsexpr.h"
+#include "virstring.h"
+#include "viruri.h"
 #include "viruuid.h"
 #include "xen_driver.h"
 #include "xen_hypervisor.h"
+#include "xen_sxpr.h"
+#include "xend_internal.h"
 #include "xs_internal.h" /* To extract VNC port & Serial console TTY */
-#include "viralloc.h"
-#include "count-one-bits.h"
-#include "virfile.h"
-#include "viruri.h"
-#include "device_conf.h"
 
 /* required for cpumap_t */
 #include <xen/dom0_ops.h>
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
index f6a3593..30ee69a 100644
--- a/src/xen/xm_internal.c
+++ b/src/xen/xm_internal.c
@@ -35,20 +35,20 @@
 #include <stdint.h>
 #include <xen/dom0_ops.h>
 
-#include "virerror.h"
+#include "count-one-bits.h"
 #include "datatypes.h"
-#include "xm_internal.h"
+#include "viralloc.h"
+#include "virbuffer.h"
+#include "virerror.h"
+#include "virhash.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "viruuid.h"
 #include "xen_driver.h"
-#include "xend_internal.h"
 #include "xen_sxpr.h"
 #include "xen_xm.h"
-#include "virhash.h"
-#include "virbuffer.h"
-#include "viruuid.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "virlog.h"
-#include "count-one-bits.h"
+#include "xend_internal.h"
+#include "xm_internal.h"
 
 #define VIR_FROM_THIS VIR_FROM_XENXM
 
diff --git a/src/xenapi/xenapi_driver.c b/src/xenapi/xenapi_driver.c
index b368f48..d293a42 100644
--- a/src/xenapi/xenapi_driver.c
+++ b/src/xenapi/xenapi_driver.c
@@ -22,23 +22,23 @@
 
 #include <config.h>
 
-#include <limits.h>
-#include <string.h>
-#include <curl/curl.h>
-#include <xen/api/xen_all.h>
-#include "internal.h"
-#include "domain_conf.h"
-#include "virerror.h"
 #include "datatypes.h"
-#include "virauth.h"
-#include "virutil.h"
-#include "viruuid.h"
+#include "domain_conf.h"
+#include "internal.h"
 #include "viralloc.h"
+#include "virauth.h"
 #include "virbuffer.h"
+#include "virerror.h"
+#include "virstring.h"
 #include "viruri.h"
+#include "viruuid.h"
 #include "xenapi_driver.h"
 #include "xenapi_driver_private.h"
 #include "xenapi_utils.h"
+#include <curl/curl.h>
+#include <limits.h>
+#include <string.h>
+#include <xen/api/xen_all.h>
 
 #define VIR_FROM_THIS VIR_FROM_XENAPI
 
diff --git a/src/xenapi/xenapi_utils.c b/src/xenapi/xenapi_utils.c
index 3b8384e..4415151 100644
--- a/src/xenapi/xenapi_utils.c
+++ b/src/xenapi/xenapi_utils.c
@@ -22,21 +22,21 @@
 
 #include <config.h>
 
-#include <stdio.h>
-#include <string.h>
-#include <xen/api/xen_all.h>
-#include "internal.h"
-#include "domain_conf.h"
-#include "virerror.h"
 #include "datatypes.h"
-#include "virutil.h"
-#include "viruuid.h"
+#include "domain_conf.h"
+#include "internal.h"
 #include "viralloc.h"
 #include "virbuffer.h"
+#include "virerror.h"
 #include "virlog.h"
+#include "virstring.h"
 #include "viruri.h"
+#include "viruuid.h"
 #include "xenapi_driver_private.h"
 #include "xenapi_utils.h"
+#include <stdio.h>
+#include <string.h>
+#include <xen/api/xen_all.h>
 
 void
 xenSessionFree(xen_session *session)
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index 83b7c74..e1aab2e 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -26,17 +26,18 @@
 
 #include <config.h>
 
+#include "count-one-bits.h"
 #include "internal.h"
-#include "virerror.h"
-#include "virconf.h"
-#include "viralloc.h"
 #include "verify.h"
-#include "viruuid.h"
+#include "viralloc.h"
+#include "virconf.h"
+#include "virerror.h"
 #include "virlog.h"
-#include "count-one-bits.h"
-#include "xenxs_private.h"
-#include "xen_sxpr.h"
 #include "virstoragefile.h"
+#include "virstring.h"
+#include "viruuid.h"
+#include "xen_sxpr.h"
+#include "xenxs_private.h"
 
 /* Get a domain id from a S-expression string */
 int xenGetDomIdFromSxprString(const char *sexpr, int xendConfigVersion)
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index 73ba06b..d523711 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -25,19 +25,20 @@
 
 #include <config.h>
 
+#include "count-one-bits.h"
+#include "domain_conf.h"
 #include "internal.h"
-#include "virerror.h"
-#include "virconf.h"
-#include "viralloc.h"
 #include "verify.h"
-#include "viruuid.h"
+#include "viralloc.h"
+#include "virconf.h"
+#include "virerror.h"
 #include "virsexpr.h"
-#include "count-one-bits.h"
-#include "xenxs_private.h"
-#include "xen_xm.h"
-#include "xen_sxpr.h"
-#include "domain_conf.h"
 #include "virstoragefile.h"
+#include "virstring.h"
+#include "viruuid.h"
+#include "xen_sxpr.h"
+#include "xen_xm.h"
+#include "xenxs_private.h"
 
 /* Convenience method to grab a long int from the config file object */
 static int xenXMConfigGetBool(virConfPtr conf,
diff --git a/tests/commandhelper.c b/tests/commandhelper.c
index 92f031f..747bec2 100644
--- a/tests/commandhelper.c
+++ b/tests/commandhelper.c
@@ -27,10 +27,10 @@
 #include <string.h>
 
 #include "internal.h"
-#include "virutil.h"
+#include "testutils.h"
 #include "viralloc.h"
 #include "virfile.h"
-#include "testutils.h"
+#include "virutil.h"
 
 #ifndef WIN32
 
diff --git a/tests/commandtest.c b/tests/commandtest.c
index ac369f9..5ad4289 100644
--- a/tests/commandtest.c
+++ b/tests/commandtest.c
@@ -28,15 +28,15 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
-#include "testutils.h"
 #include "internal.h"
 #include "nodeinfo.h"
-#include "virutil.h"
+#include "testutils.h"
 #include "viralloc.h"
 #include "vircommand.h"
+#include "virerror.h"
 #include "virfile.h"
 #include "virpidfile.h"
-#include "virerror.h"
+#include "virstring.h"
 #include "virthread.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
diff --git a/tests/cputest.c b/tests/cputest.c
index ab96824..89cb328 100644
--- a/tests/cputest.c
+++ b/tests/cputest.c
@@ -30,14 +30,15 @@
 #include <sys/types.h>
 #include <fcntl.h>
 
+#include "cpu/cpu.h"
+#include "cpu/cpu_map.h"
+#include "cpu_conf.h"
 #include "internal.h"
-#include "virxml.h"
+#include "testutils.h"
 #include "viralloc.h"
 #include "virbuffer.h"
-#include "testutils.h"
-#include "cpu_conf.h"
-#include "cpu/cpu.h"
-#include "cpu/cpu_map.h"
+#include "virstring.h"
+#include "virxml.h"
 
 static const char *abs_top_srcdir;
 
diff --git a/tests/domainsnapshotxml2xmltest.c b/tests/domainsnapshotxml2xmltest.c
index 7d95310..dbd04a7 100644
--- a/tests/domainsnapshotxml2xmltest.c
+++ b/tests/domainsnapshotxml2xmltest.c
@@ -11,10 +11,11 @@
 #ifdef WITH_QEMU
 
 # include "internal.h"
-# include "testutils.h"
 # include "qemu/qemu_conf.h"
 # include "qemu/qemu_domain.h"
+# include "testutils.h"
 # include "testutilsqemu.h"
+# include "virstring.h"
 
 static virQEMUDriver driver;
 
diff --git a/tests/esxutilstest.c b/tests/esxutilstest.c
index 55b3623..5bb09b3 100644
--- a/tests/esxutilstest.c
+++ b/tests/esxutilstest.c
@@ -9,7 +9,6 @@
 # include "internal.h"
 # include "viralloc.h"
 # include "testutils.h"
-# include "virutil.h"
 # include "vmx/vmx.h"
 # include "esx/esx_util.h"
 # include "esx/esx_vi_types.h"
diff --git a/tests/eventtest.c b/tests/eventtest.c
index 16a693c..41e59fc 100644
--- a/tests/eventtest.c
+++ b/tests/eventtest.c
@@ -26,12 +26,12 @@
 #include <signal.h>
 #include <time.h>
 
-#include "testutils.h"
 #include "internal.h"
-#include "virthread.h"
+#include "testutils.h"
+#include "vireventpoll.h"
 #include "virlog.h"
+#include "virthread.h"
 #include "virutil.h"
-#include "vireventpoll.h"
 
 #define NUM_FDS 31
 #define NUM_TIME 31
diff --git a/tests/interfacexml2xmltest.c b/tests/interfacexml2xmltest.c
index f969fa1..0879bc9 100644
--- a/tests/interfacexml2xmltest.c
+++ b/tests/interfacexml2xmltest.c
@@ -8,11 +8,11 @@
 #include <sys/types.h>
 #include <fcntl.h>
 
+#include "interface_conf.h"
 #include "internal.h"
 #include "testutils.h"
-#include "interface_conf.h"
 #include "testutilsqemu.h"
-
+#include "virstring.h"
 
 static int
 testCompareXMLToXMLFiles(const char *xml)
diff --git a/tests/libvirtdconftest.c b/tests/libvirtdconftest.c
index 01e9415..a25d6ee 100644
--- a/tests/libvirtdconftest.c
+++ b/tests/libvirtdconftest.c
@@ -22,13 +22,14 @@
 
 #include <stdlib.h>
 
-#include "testutils.h"
-#include "daemon/libvirtd-config.h"
-#include "virutil.h"
 #include "c-ctype.h"
+#include "daemon/libvirtd-config.h"
+#include "testutils.h"
+#include "virconf.h"
 #include "virerror.h"
 #include "virlog.h"
-#include "virconf.h"
+#include "virstring.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/tests/lxcxml2xmltest.c b/tests/lxcxml2xmltest.c
index 964d433..1332e4b 100644
--- a/tests/lxcxml2xmltest.c
+++ b/tests/lxcxml2xmltest.c
@@ -11,9 +11,10 @@
 #ifdef WITH_LXC
 
 # include "internal.h"
-# include "testutils.h"
 # include "lxc/lxc_conf.h"
+# include "testutils.h"
 # include "testutilslxc.h"
+# include "virstring.h"
 
 static virCapsPtr caps;
 static virDomainXMLConfPtr xmlconf;
diff --git a/tests/networkxml2conftest.c b/tests/networkxml2conftest.c
index 88016ee..f393c4b 100644
--- a/tests/networkxml2conftest.c
+++ b/tests/networkxml2conftest.c
@@ -9,11 +9,12 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "testutils.h"
+#include "network/bridge_driver.h"
 #include "network_conf.h"
-#include "vircommand.h"
+#include "testutils.h"
 #include "viralloc.h"
-#include "network/bridge_driver.h"
+#include "vircommand.h"
+#include "virstring.h"
 
 static int
 testCompareXMLToConfFiles(const char *inxml, const char *outconf, dnsmasqCapsPtr caps)
diff --git a/tests/networkxml2xmltest.c b/tests/networkxml2xmltest.c
index 1063435..547a2d8 100644
--- a/tests/networkxml2xmltest.c
+++ b/tests/networkxml2xmltest.c
@@ -9,9 +9,10 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "testutils.h"
 #include "network_conf.h"
+#include "testutils.h"
 #include "testutilsqemu.h"
+#include "virstring.h"
 
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
diff --git a/tests/nodedevxml2xmltest.c b/tests/nodedevxml2xmltest.c
index 38f2e9a..1ae187f 100644
--- a/tests/nodedevxml2xmltest.c
+++ b/tests/nodedevxml2xmltest.c
@@ -9,9 +9,10 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "testutils.h"
 #include "node_device_conf.h"
+#include "testutils.h"
 #include "testutilsqemu.h"
+#include "virstring.h"
 
 static int
 testCompareXMLToXMLFiles(const char *xml)
diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index d900eb9..c61b32c 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -5,11 +5,11 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "testutils.h"
 #include "internal.h"
 #include "nodeinfo.h"
-#include "virutil.h"
+#include "testutils.h"
 #include "virfile.h"
+#include "virstring.h"
 
 #if ! (defined __linux__  &&  (defined(__x86_64__) || \
                                defined(__amd64__)  || \
diff --git a/tests/nwfilterxml2xmltest.c b/tests/nwfilterxml2xmltest.c
index a215bf8..c2b9edd 100644
--- a/tests/nwfilterxml2xmltest.c
+++ b/tests/nwfilterxml2xmltest.c
@@ -9,12 +9,13 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "testutils.h"
-#include "virxml.h"
-#include "virthread.h"
-#include "nwfilter_params.h"
 #include "nwfilter_conf.h"
+#include "nwfilter_params.h"
+#include "testutils.h"
 #include "testutilsqemu.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virxml.h"
 
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml,
diff --git a/tests/openvzutilstest.c b/tests/openvzutilstest.c
index 9fb7178..8044389 100644
--- a/tests/openvzutilstest.c
+++ b/tests/openvzutilstest.c
@@ -7,10 +7,10 @@
 # include <unistd.h>
 
 # include "internal.h"
-# include "viralloc.h"
-# include "testutils.h"
-# include "virutil.h"
 # include "openvz/openvz_conf.h"
+# include "testutils.h"
+# include "viralloc.h"
+# include "virstring.h"
 
 static int
 testLocateConfFile(int vpsid ATTRIBUTE_UNUSED, char **conffile,
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index 6fd1de6..a3589d0 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -11,10 +11,10 @@
 #ifdef WITH_QEMU
 
 # include "internal.h"
-# include "testutils.h"
 # include "qemu/qemu_command.h"
-
+# include "testutils.h"
 # include "testutilsqemu.h"
+# include "virstring.h"
 
 static virQEMUDriver driver;
 
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 05bb8a6..e434194 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -5,9 +5,10 @@
 # include <stdio.h>
 # include <stdlib.h>
 
-# include "testutils.h"
 # include "qemu/qemu_capabilities.h"
+# include "testutils.h"
 # include "viralloc.h"
+# include "virstring.h"
 
 struct testInfo {
     const char *name;
diff --git a/tests/qemumonitortest.c b/tests/qemumonitortest.c
index 285dfa8..b1c28c4 100644
--- a/tests/qemumonitortest.c
+++ b/tests/qemumonitortest.c
@@ -10,7 +10,6 @@
 # include "internal.h"
 # include "viralloc.h"
 # include "testutils.h"
-# include "virutil.h"
 # include "qemu/qemu_monitor.h"
 
 struct testEscapeString
diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c
index d5bce84..437e66b 100644
--- a/tests/qemumonitortestutils.c
+++ b/tests/qemumonitortestutils.c
@@ -26,13 +26,13 @@
 
 #include "qemumonitortestutils.h"
 
-#include "virthread.h"
 #include "qemu/qemu_monitor.h"
 #include "rpc/virnetsocket.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virlog.h"
 #include "virerror.h"
+#include "virlog.h"
+#include "virstring.h"
+#include "virthread.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 38787ac..3bb2c61 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -10,16 +10,16 @@
 
 #ifdef WITH_QEMU
 
+# include "cpu/cpu_map.h"
+# include "datatypes.h"
 # include "internal.h"
-# include "testutils.h"
-# include "viralloc.h"
 # include "qemu/qemu_capabilities.h"
 # include "qemu/qemu_command.h"
 # include "qemu/qemu_domain.h"
-# include "datatypes.h"
-# include "cpu/cpu_map.h"
-
+# include "testutils.h"
 # include "testutilsqemu.h"
+# include "viralloc.h"
+# include "virstring.h"
 
 static const char *abs_top_srcdir;
 static virQEMUDriver driver;
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index ba9aa96..5aa9c44 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -11,10 +11,11 @@
 #ifdef WITH_QEMU
 
 # include "internal.h"
-# include "testutils.h"
 # include "qemu/qemu_conf.h"
 # include "qemu/qemu_domain.h"
+# include "testutils.h"
 # include "testutilsqemu.h"
+# include "virstring.h"
 
 static virQEMUDriver driver;
 
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 76a715d..be96aad 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -10,15 +10,15 @@
 
 #ifdef WITH_QEMU
 
+# include "cpu/cpu_map.h"
+# include "datatypes.h"
 # include "internal.h"
-# include "testutils.h"
 # include "qemu/qemu_capabilities.h"
 # include "qemu/qemu_command.h"
 # include "qemu/qemu_domain.h"
-# include "datatypes.h"
-# include "cpu/cpu_map.h"
-
+# include "testutils.h"
 # include "testutilsqemu.h"
+# include "virstring.h"
 
 static const char *abs_top_srcdir;
 static virQEMUDriver driver;
diff --git a/tests/securityselinuxlabeltest.c b/tests/securityselinuxlabeltest.c
index 405bc2b..244c6b9 100644
--- a/tests/securityselinuxlabeltest.c
+++ b/tests/securityselinuxlabeltest.c
@@ -30,16 +30,15 @@
 #include <selinux/context.h>
 
 #include "internal.h"
+#include "qemu/qemu_domain.h"
+#include "security/security_manager.h"
 #include "testutils.h"
 #include "testutilsqemu.h"
-#include "qemu/qemu_domain.h"
 #include "viralloc.h"
 #include "virerror.h"
 #include "virfile.h"
 #include "virlog.h"
-#include "virutil.h"
-#include "security/security_manager.h"
-
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/tests/securityselinuxtest.c b/tests/securityselinuxtest.c
index da8a12f..e74f578 100644
--- a/tests/securityselinuxtest.c
+++ b/tests/securityselinuxtest.c
@@ -29,13 +29,12 @@
 #include <selinux/context.h>
 
 #include "internal.h"
+#include "security/security_manager.h"
 #include "testutils.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virlog.h"
 #include "virerror.h"
-#include "security/security_manager.h"
-
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
index b7487ef..2496914 100644
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -4,14 +4,15 @@
 #include <string.h>
 #include <unistd.h>
 
+#include "datatypes.h"
 #include "internal.h"
+#include "testutils.h"
+#include "testutilsxen.h"
+#include "virstring.h"
 #include "virxml.h"
-#include "datatypes.h"
 #include "xen/xen_driver.h"
 #include "xen/xend_internal.h"
 #include "xenxs/xen_sxpr.h"
-#include "testutils.h"
-#include "testutilsxen.h"
 
 static virCapsPtr caps;
 
diff --git a/tests/storagepoolxml2xmltest.c b/tests/storagepoolxml2xmltest.c
index 8cac978..1885763 100644
--- a/tests/storagepoolxml2xmltest.c
+++ b/tests/storagepoolxml2xmltest.c
@@ -9,9 +9,10 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "testutils.h"
 #include "storage_conf.h"
+#include "testutils.h"
 #include "testutilsqemu.h"
+#include "virstring.h"
 
 static int
 testCompareXMLToXMLFiles(const char *inxml, const char *outxml)
diff --git a/tests/storagevolxml2argvtest.c b/tests/storagevolxml2argvtest.c
index 77ba800..bf035c7 100644
--- a/tests/storagevolxml2argvtest.c
+++ b/tests/storagevolxml2argvtest.c
@@ -1,10 +1,11 @@
 #include <config.h>
 
-#include "internal.h"
-#include "testutils.h"
 #include "datatypes.h"
+#include "internal.h"
 #include "storage/storage_backend.h"
+#include "testutils.h"
 #include "testutilsqemu.h"
+#include "virstring.h"
 
 const char create_tool[] = "qemu-img";
 
diff --git a/tests/storagevolxml2xmltest.c b/tests/storagevolxml2xmltest.c
index 0902496..f1a07bd 100644
--- a/tests/storagevolxml2xmltest.c
+++ b/tests/storagevolxml2xmltest.c
@@ -9,9 +9,10 @@
 #include <fcntl.h>
 
 #include "internal.h"
-#include "testutils.h"
 #include "storage_conf.h"
+#include "testutils.h"
 #include "testutilsqemu.h"
+#include "virstring.h"
 
 static int
 testCompareXMLToXMLFiles(const char *poolxml, const char *inxml,
diff --git a/tests/sysinfotest.c b/tests/sysinfotest.c
index aee57e6..d570638 100644
--- a/tests/sysinfotest.c
+++ b/tests/sysinfotest.c
@@ -29,12 +29,11 @@
 #include <unistd.h>
 
 #include "internal.h"
-
-#include "virbuffer.h"
-#include "virsysinfo.h"
 #include "testutils.h"
-#include "virutil.h"
+#include "virbuffer.h"
 #include "virfile.h"
+#include "virstring.h"
+#include "virsysinfo.h"
 
 #if defined (__linux__)
 
diff --git a/tests/testutils.c b/tests/testutils.c
index 0fb69ec..9e95029 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -22,29 +22,31 @@
 
 #include <config.h>
 
+#include <fcntl.h>
+#include <limits.h>
+#include <regex.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#include <sys/stat.h>
 #include <sys/wait.h>
-#include <regex.h>
 #include <unistd.h>
-#include <string.h>
-#include <fcntl.h>
-#include <limits.h>
-#include "testutils.h"
+
+#include "dirname.h"
 #include "internal.h"
+#include "testutils.h"
 #include "viralloc.h"
-#include "virutil.h"
-#include "virthread.h"
-#include "virerror.h"
 #include "virbuffer.h"
-#include "virlog.h"
 #include "vircommand.h"
-#include "virrandom.h"
-#include "dirname.h"
+#include "virerror.h"
+#include "virlog.h"
 #include "virprocess.h"
+#include "virrandom.h"
+#include "virstring.h"
+#include "virthread.h"
+#include "virutil.h"
 
 #if TEST_OOM_TRACE
 # include <execinfo.h>
diff --git a/tests/utiltest.c b/tests/utiltest.c
index 9d18652..428fcda 100644
--- a/tests/utiltest.c
+++ b/tests/utiltest.c
@@ -6,11 +6,10 @@
 #include <unistd.h>
 
 #include "internal.h"
-#include "viralloc.h"
 #include "testutils.h"
+#include "viralloc.h"
 #include "virutil.h"
 
-
 static void
 testQuietError(void *userData ATTRIBUTE_UNUSED,
                virErrorPtr error ATTRIBUTE_UNUSED)
diff --git a/tests/virauthconfigtest.c b/tests/virauthconfigtest.c
index 67c5de8..a27bae5 100644
--- a/tests/virauthconfigtest.c
+++ b/tests/virauthconfigtest.c
@@ -24,7 +24,6 @@
 #include <signal.h>
 
 #include "testutils.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/virbuftest.c b/tests/virbuftest.c
index 7f9ee66..14e8676 100644
--- a/tests/virbuftest.c
+++ b/tests/virbuftest.c
@@ -5,10 +5,10 @@
 #include <string.h>
 
 #include "internal.h"
-#include "virutil.h"
 #include "testutils.h"
-#include "virbuffer.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "virstring.h"
 
 #define TEST_ERROR(...)                             \
     do {                                            \
diff --git a/tests/virdrivermoduletest.c b/tests/virdrivermoduletest.c
index bbceb96..1aae245 100644
--- a/tests/virdrivermoduletest.c
+++ b/tests/virdrivermoduletest.c
@@ -21,7 +21,6 @@
 #include <config.h>
 
 #include "testutils.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/virhashtest.c b/tests/virhashtest.c
index 6e4f267..e54106b 100644
--- a/tests/virhashtest.c
+++ b/tests/virhashtest.c
@@ -6,13 +6,12 @@
 #include <time.h>
 
 #include "internal.h"
-#include "virhash.h"
-#include "virhashdata.h"
 #include "testutils.h"
 #include "viralloc.h"
-#include "virutil.h"
+#include "virhash.h"
+#include "virhashdata.h"
 #include "virlog.h"
-
+#include "virstring.h"
 
 #define testError(...)                                          \
     do {                                                        \
diff --git a/tests/viridentitytest.c b/tests/viridentitytest.c
index e898795..269a57d 100644
--- a/tests/viridentitytest.c
+++ b/tests/viridentitytest.c
@@ -25,7 +25,6 @@
 #include "testutils.h"
 
 #include "viridentity.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/virkeyfiletest.c b/tests/virkeyfiletest.c
index fb41840..8fe7e38 100644
--- a/tests/virkeyfiletest.c
+++ b/tests/virkeyfiletest.c
@@ -24,7 +24,6 @@
 #include <signal.h>
 
 #include "testutils.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/virlockspacetest.c b/tests/virlockspacetest.c
index 7678396..6076b95 100644
--- a/tests/virlockspacetest.c
+++ b/tests/virlockspacetest.c
@@ -20,17 +20,17 @@
 
 #include <config.h>
 
-#include <stdlib.h>
 #include <signal.h>
+#include <stdlib.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 #include "testutils.h"
-#include "virutil.h"
-#include "virerror.h"
 #include "viralloc.h"
-#include "virlog.h"
-
+#include "virerror.h"
 #include "virlockspace.h"
+#include "virlog.h"
+#include "virutil.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/tests/virnetmessagetest.c b/tests/virnetmessagetest.c
index e58fd1f..96defe4 100644
--- a/tests/virnetmessagetest.c
+++ b/tests/virnetmessagetest.c
@@ -24,7 +24,6 @@
 #include <signal.h>
 
 #include "testutils.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index aaa6acb..b4b0ddb 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -26,15 +26,15 @@
 # include <ifaddrs.h>
 #endif
 #include <netdb.h>
+#include <unistd.h>
 
+#include "rpc/virnetsocket.h"
 #include "testutils.h"
-#include "virutil.h"
-#include "virerror.h"
 #include "viralloc.h"
-#include "virlog.h"
+#include "virerror.h"
 #include "virfile.h"
-
-#include "rpc/virnetsocket.h"
+#include "virlog.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/tests/virnettlscontexttest.c b/tests/virnettlscontexttest.c
index 908432b..dcb1b76 100644
--- a/tests/virnettlscontexttest.c
+++ b/tests/virnettlscontexttest.c
@@ -26,15 +26,15 @@
 #include <gnutls/gnutls.h>
 #include <gnutls/x509.h>
 
+#include "gnutls_1_0_compat.h"
 #include "testutils.h"
-#include "virutil.h"
-#include "virerror.h"
 #include "viralloc.h"
-#include "virlog.h"
-#include "virfile.h"
 #include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
+#include "virlog.h"
 #include "virsocketaddr.h"
-#include "gnutls_1_0_compat.h"
+#include "virutil.h"
 
 #if !defined WIN32 && HAVE_LIBTASN1_H && LIBGNUTLS_VERSION_NUMBER >= 0x020600
 # include <libtasn1.h>
diff --git a/tests/virportallocatortest.c b/tests/virportallocatortest.c
index 9931e11..14f42b9 100644
--- a/tests/virportallocatortest.c
+++ b/tests/virportallocatortest.c
@@ -46,12 +46,13 @@ int bind(int sockfd ATTRIBUTE_UNUSED,
 
 #else
 # include <stdlib.h>
+# include <unistd.h>
 
 # include "testutils.h"
-# include "virutil.h"
-# include "virerror.h"
 # include "viralloc.h"
+# include "virerror.h"
 # include "virlog.h"
+# include "virstring.h"
 
 # include "virportallocator.h"
 
diff --git a/tests/virshtest.c b/tests/virshtest.c
index b82a4c4..1ddf8da 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -5,9 +5,9 @@
 #include <unistd.h>
 
 #include "internal.h"
-#include "virxml.h"
-#include "virutil.h"
 #include "testutils.h"
+#include "virstring.h"
+#include "virxml.h"
 
 #ifdef WIN32
 
diff --git a/tests/virstoragetest.c b/tests/virstoragetest.c
index d495e6a..ff3ea7c 100644
--- a/tests/virstoragetest.c
+++ b/tests/virstoragetest.c
@@ -27,6 +27,7 @@
 #include "virerror.h"
 #include "virlog.h"
 #include "virstoragefile.h"
+#include "virstring.h"
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
diff --git a/tests/virstringtest.c b/tests/virstringtest.c
index 86d8986..db1e8a9 100644
--- a/tests/virstringtest.c
+++ b/tests/virstringtest.c
@@ -23,7 +23,6 @@
 #include <stdlib.h>
 
 #include "testutils.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/virtimetest.c b/tests/virtimetest.c
index 18f621a..7768ecb 100644
--- a/tests/virtimetest.c
+++ b/tests/virtimetest.c
@@ -24,7 +24,6 @@
 #include <signal.h>
 
 #include "testutils.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/viruritest.c b/tests/viruritest.c
index 3cb88da..0bcd78d 100644
--- a/tests/viruritest.c
+++ b/tests/viruritest.c
@@ -24,7 +24,6 @@
 #include <signal.h>
 
 #include "testutils.h"
-#include "virutil.h"
 #include "virerror.h"
 #include "viralloc.h"
 #include "virlog.h"
diff --git a/tests/vmx2xmltest.c b/tests/vmx2xmltest.c
index cee4c39..a4923aa 100644
--- a/tests/vmx2xmltest.c
+++ b/tests/vmx2xmltest.c
@@ -7,8 +7,9 @@
 # include <unistd.h>
 
 # include "internal.h"
-# include "viralloc.h"
 # include "testutils.h"
+# include "viralloc.h"
+# include "virstring.h"
 # include "vmx/vmx.h"
 
 static virCapsPtr caps;
diff --git a/tests/xencapstest.c b/tests/xencapstest.c
index 381802e..e361a93 100644
--- a/tests/xencapstest.c
+++ b/tests/xencapstest.c
@@ -6,10 +6,11 @@
 #include <unistd.h>
 
 #include "internal.h"
-#include "virxml.h"
 #include "testutils.h"
-#include "xen/xen_hypervisor.h"
 #include "virfile.h"
+#include "virstring.h"
+#include "virxml.h"
+#include "xen/xen_hypervisor.h"
 
 static int
 testCompareFiles(virArch hostmachine, const char *xml_rel,
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index a32c11a..176f318 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -27,14 +27,15 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "internal.h"
 #include "datatypes.h"
-#include "xen/xen_driver.h"
-#include "xen/xm_internal.h"
-#include "xenxs/xen_xm.h"
+#include "internal.h"
 #include "testutils.h"
 #include "testutilsxen.h"
 #include "viralloc.h"
+#include "virstring.h"
+#include "xen/xen_driver.h"
+#include "xen/xm_internal.h"
+#include "xenxs/xen_xm.h"
 
 static virCapsPtr caps;
 static virDomainXMLConfPtr xmlconf;
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
index 364601a..5710faf 100644
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -9,10 +9,11 @@
 #include <unistd.h>
 
 #include "internal.h"
-#include "xen/xend_internal.h"
-#include "xenxs/xen_sxpr.h"
 #include "testutils.h"
 #include "testutilsxen.h"
+#include "virstring.h"
+#include "xen/xend_internal.h"
+#include "xenxs/xen_sxpr.h"
 
 static virCapsPtr caps;
 static virDomainXMLConfPtr xmlconf;
diff --git a/tests/xml2vmxtest.c b/tests/xml2vmxtest.c
index 800fd2c..acd2283 100644
--- a/tests/xml2vmxtest.c
+++ b/tests/xml2vmxtest.c
@@ -7,8 +7,9 @@
 # include <unistd.h>
 
 # include "internal.h"
-# include "viralloc.h"
 # include "testutils.h"
+# include "viralloc.h"
+# include "virstring.h"
 # include "vmx/vmx.h"
 
 static virCapsPtr caps;
diff --git a/tools/console.c b/tools/console.c
index e423134..9abfb58 100644
--- a/tools/console.c
+++ b/tools/console.c
@@ -39,7 +39,6 @@
 # include "internal.h"
 # include "console.h"
 # include "virlog.h"
-# include "virutil.h"
 # include "virfile.h"
 # include "viralloc.h"
 # include "virthread.h"
diff --git a/tools/virsh-domain-monitor.c b/tools/virsh-domain-monitor.c
index d34878f..0988db8 100644
--- a/tools/virsh-domain-monitor.c
+++ b/tools/virsh-domain-monitor.c
@@ -31,12 +31,13 @@
 #include <libxml/xpath.h>
 #include <libxml/xmlsave.h>
 
-#include "internal.h"
 #include "conf/domain_conf.h"
+#include "internal.h"
 #include "intprops.h"
 #include "viralloc.h"
 #include "virmacaddr.h"
 #include "virsh-domain.h"
+#include "virstring.h"
 #include "virxml.h"
 
 static const char *
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 965f92c..1794976 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -44,7 +44,6 @@
 #include "console.h"
 #include "viralloc.h"
 #include "vircommand.h"
-#include "virutil.h"
 #include "virfile.h"
 #include "virjson.h"
 #include "virkeycode.h"
diff --git a/tools/virsh-host.c b/tools/virsh-host.c
index 2d49296..5cce328 100644
--- a/tools/virsh-host.c
+++ b/tools/virsh-host.c
@@ -32,12 +32,12 @@
 #include <libxml/xmlsave.h>
 
 #include "internal.h"
-#include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
+#include "virbuffer.h"
 #include "virsh-domain.h"
-#include "virxml.h"
+#include "virstring.h"
 #include "virtypedparam.h"
+#include "virxml.h"
 
 /*
  * "capabilities" command
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index c022e1d..22ff5cc 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -32,8 +32,9 @@
 #include <libxml/xmlsave.h>
 
 #include "internal.h"
-#include "virbuffer.h"
 #include "viralloc.h"
+#include "virbuffer.h"
+#include "virstring.h"
 #include "virutil.h"
 #include "virxml.h"
 
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index bc1a64a..81267bc 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -34,7 +34,6 @@
 #include "internal.h"
 #include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "virxml.h"
 #include "conf/network_conf.h"
 
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 9c0bd90..22c7cd4 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -34,7 +34,6 @@
 #include "internal.h"
 #include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "virxml.h"
 #include "conf/node_device_conf.h"
 
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index 3b1e1e4..8036578 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -32,8 +32,8 @@
 #include <libxml/xmlsave.h>
 
 #include "internal.h"
-#include "virbuffer.h"
 #include "viralloc.h"
+#include "virbuffer.h"
 #include "virutil.h"
 #include "virxml.h"
 
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index c1e91ea..ebeb605 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -31,12 +31,12 @@
 #include <libxml/xpath.h>
 #include <libxml/xmlsave.h>
 
+#include "conf/storage_conf.h"
 #include "internal.h"
-#include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
+#include "virbuffer.h"
+#include "virstring.h"
 #include "virxml.h"
-#include "conf/storage_conf.h"
 
 virStoragePoolPtr
 vshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname,
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 7201522..d697d8b 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -31,10 +31,10 @@
 #include <libxml/xpath.h>
 #include <libxml/xmlsave.h>
 
-#include "internal.h"
 #include "base64.h"
-#include "virbuffer.h"
+#include "internal.h"
 #include "viralloc.h"
+#include "virbuffer.h"
 #include "virutil.h"
 #include "virxml.h"
 
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 44a1e03..4f5fa15 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -36,7 +36,6 @@
 #include "internal.h"
 #include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
 #include "virsh-domain.h"
 #include "virxml.h"
 #include "conf/snapshot_conf.h"
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index 0ca295f..bc676a0 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -34,11 +34,12 @@
 #include <libxml/xmlsave.h>
 
 #include "internal.h"
-#include "virbuffer.h"
 #include "viralloc.h"
-#include "virutil.h"
+#include "virbuffer.h"
 #include "virfile.h"
 #include "virsh-pool.h"
+#include "virstring.h"
+#include "virutil.h"
 #include "virxml.h"
 
 virStorageVolPtr
diff --git a/tools/virsh.c b/tools/virsh.c
index 7ff12ec..e8b9945 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -52,28 +52,28 @@
 # include <readline/history.h>
 #endif
 
-#include "internal.h"
-#include "virerror.h"
 #include "base64.h"
-#include "virbuffer.h"
+#include "conf/domain_conf.h"
+#include "configmake.h"
 #include "console.h"
-#include "virutil.h"
-#include "viralloc.h"
-#include "virxml.h"
-#include "libvirt/libvirt-qemu.h"
+#include "internal.h"
 #include "libvirt/libvirt-lxc.h"
-#include "virfile.h"
-#include "configmake.h"
-#include "virthread.h"
+#include "libvirt/libvirt-qemu.h"
+#include "viralloc.h"
+#include "virbitmap.h"
+#include "virbuffer.h"
 #include "vircommand.h"
+#include "virerror.h"
+#include "virfile.h"
 #include "virkeycode.h"
 #include "virnetdevbandwidth.h"
-#include "virbitmap.h"
-#include "conf/domain_conf.h"
+#include "virstring.h"
+#include "virthread.h"
 #include "virtypedparam.h"
+#include "virxml.h"
 
-#include "virsh-domain.h"
 #include "virsh-domain-monitor.h"
+#include "virsh-domain.h"
 #include "virsh-host.h"
 #include "virsh-interface.h"
 #include "virsh-network.h"
diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c
index 34a527f..5c22a21 100644
--- a/tools/virt-host-validate-common.c
+++ b/tools/virt-host-validate-common.c
@@ -27,10 +27,11 @@
 #include <unistd.h>
 #include <sys/utsname.h>
 
-#include "virutil.h"
 #include "viralloc.h"
 #include "virfile.h"
+#include "virstring.h"
 #include "virt-host-validate-common.h"
+#include "virutil.h"
 
 static bool quiet;
 
-- 
1.8.1.5

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




[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]