From nobody Fri May 16 05:33:20 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1501063378908290.7457028599208; Wed, 26 Jul 2017 03:02:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FB6B3680F; Wed, 26 Jul 2017 10:02:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E20EE6442C; Wed, 26 Jul 2017 10:02:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8AA1714B2B; Wed, 26 Jul 2017 10:02:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6QA0v9r008764 for ; Wed, 26 Jul 2017 06:00:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id B8EC051C89; Wed, 26 Jul 2017 10:00:57 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA2076FE74; Wed, 26 Jul 2017 10:00:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0FB6B3680F Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 26 Jul 2017 12:00:35 +0200 Message-Id: <4d2e0fd9fed41cfe407a200b3a7d3271417352f5.1501062802.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 05/24] tests: utils: Don't calculate file size in virTestLoadFile X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 26 Jul 2017 10:02:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The callers don't use it so don't waste a strlen(). Also fix the comment for the function. --- tests/testutils.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/testutils.c b/tests/testutils.c index ed01136a0..7f1c4672b 100644 --- a/tests/testutils.c +++ b/tests/testutils.c @@ -289,9 +289,17 @@ virTestRun(const char *title, return ret; } -/* Allocate BUF to the size of FILE. Read FILE into buffer BUF. - Upon any failure, diagnose it and return -1, but don't bother trying - to preserve errno. Otherwise, return the number of bytes copied into BU= F. */ + +/** + * virTestLoadFile: + * @file: name of the file to load + * @buf: buffer to load the file into + * + * Allocates @buf to the size of FILE. Reads FILE into buffer BUF. + * Upon any failure, error is printed to stderr and -1 is returned. 'errno= ' is + * not preserved. On success 0 is returned. Caller is responsible for free= ing + * @buf. + */ int virTestLoadFile(const char *file, char **buf) { @@ -345,7 +353,7 @@ virTestLoadFile(const char *file, char **buf) } VIR_FORCE_FCLOSE(fp); - return strlen(*buf); + return 0; } #ifndef WIN32 --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list