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

Martin Kletzander mkletzan at redhat.com
Wed Jul 27 06:26:05 UTC 2016


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 at redhat.com>
>---
> 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160727/f2c50f52/attachment-0001.sig>


More information about the libvir-list mailing list