Re: [PATCH 1/2] virstoragefile: refactor virStorageFileMatchesNNN methods

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

 



On Tue, Jul 26, 2016 at 07:12:29PM +0100, Daniel P. Berrange wrote:
Refactor the virStorageFileMatchesNNN methods so that
they don't take a struct FileFormatInfo parameter, but
instead get the actual raw dat items they needs. This
will facilitate reuse in other contexts.

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
src/util/virstoragefile.c | 63 ++++++++++++++++++++++++++++-------------------
1 file changed, 37 insertions(+), 26 deletions(-)

diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
index 16de603..2834baa 100644
--- a/src/util/virstoragefile.c
+++ b/src/util/virstoragefile.c
@@ -644,44 +646,44 @@ virStorageFileMatchesVersion(int format,
    size_t i;

    /* Validate version number info */
-    if (fileTypeInfo[format].versionOffset == -1)
+    if (versionOffset == -1)
        return false;

    /* -2 == non-versioned file format, so trivially match */
-    if (fileTypeInfo[format].versionOffset == -2)
+    if (versionOffset == -2)
        return true;

    /* A positive versionOffset, requires using a valid versionSize */
-    if (fileTypeInfo[format].versionSize != 2 &&
-        fileTypeInfo[format].versionSize != 4)
+    if (versionSize != 2 &&
+        versionSize != 4)
        return false;

-    if ((fileTypeInfo[format].versionOffset +
-         fileTypeInfo[format].versionSize) > buflen)
+    if ((versionOffset +
+         versionSize) > buflen)

Unwrap shortened lines like this ^^ so it's readable, please.

ACK with that changed.

Attachment: signature.asc
Description: Digital signature

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