[libvirt] [PATCH 32/34] tests: use g_strdup instead of VIR_STRDUP

Michal Privoznik mprivozn at redhat.com
Mon Oct 21 09:39:05 UTC 2019


On 10/20/19 2:55 PM, Ján Tomko wrote:
> Replace all occurrences of
>    if (VIR_STRDUP(a, b) < 0)
>       /* effectively dead code */
> with:
>    a = g_strdup(b);
> 
> Signed-off-by: Ján Tomko <jtomko at redhat.com>
> ---
>   tests/bhyvexml2argvmock.c               |  6 +--
>   tests/commandtest.c                     |  5 +--
>   tests/cputest.c                         |  4 +-
>   tests/domaincapstest.c                  | 13 +++---
>   tests/nssmock.c                         |  3 +-
>   tests/openvzutilstest.c                 |  5 ++-
>   tests/qemublocktest.c                   |  3 +-
>   tests/qemudomaincheckpointxml2xmltest.c |  9 ++--
>   tests/qemufirmwaretest.c                |  3 +-
>   tests/qemuhotplugtest.c                 |  8 +---
>   tests/qemumemlocktest.c                 |  5 +--
>   tests/qemumonitorjsontest.c             |  3 +-
>   tests/qemumonitortestutils.c            | 32 ++++++--------
>   tests/qemusecuritymock.c                |  6 +--
>   tests/qemuvhostusertest.c               |  3 +-
>   tests/qemuxml2argvtest.c                | 55 ++++++++-----------------
>   tests/qemuxml2xmltest.c                 |  5 +--
>   tests/scsihosttest.c                    |  5 +--
>   tests/securityselinuxlabeltest.c        |  8 +---
>   tests/securityselinuxtest.c             | 13 +++---
>   tests/storagebackendsheepdogtest.c      |  6 +--
>   tests/testutils.c                       |  3 +-
>   tests/testutilsqemu.c                   | 31 +++++---------
>   tests/vboxsnapshotxmltest.c             |  4 +-
>   tests/viralloctest.c                    |  3 +-
>   tests/vircgrouptest.c                   |  5 +--
>   tests/virfilecachetest.c                |  7 +---
>   tests/virfirewalltest.c                 |  8 ++--
>   tests/virhostdevtest.c                  |  8 +---
>   tests/virnetmessagetest.c               | 11 ++---
>   tests/virpcimock.c                      | 19 +++++----
>   tests/virpcitest.c                      |  5 +--
>   tests/virscsitest.c                     |  5 +--
>   tests/virstoragetest.c                  |  6 +--
>   tests/virstringtest.c                   |  9 ++--
>   tests/virtestmock.c                     |  3 +-
>   tests/virusbmock.c                      |  4 +-
>   tests/vmx2xmltest.c                     |  3 +-
>   tests/xml2vmxtest.c                     |  3 +-
>   39 files changed, 115 insertions(+), 222 deletions(-)

There's one more occurrance in tests/virstringtest.c:273 but it looks 
like the test case can be dropped completely - we don't need to test 
whether g_strdup() behaves sanely, do we?

Michal




More information about the libvir-list mailing list