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

Ján Tomko jtomko at redhat.com
Tue Oct 22 13:34:32 UTC 2019


On Mon, Oct 21, 2019 at 11:39:05AM +0200, Michal Privoznik wrote:
>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?
>

Yes, however the test also checks VIR_STRNDUP which I have not removed
yet.

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191022/d29c698e/attachment-0001.sig>


More information about the libvir-list mailing list