On Thu, Nov 14, 2019 at 08:11:46AM +0100, Peter Krempa wrote:
On Wed, Nov 13, 2019 at 16:48:48 +0100, Ján Tomko wrote:
Using GRegex simplifies the code since g_match_info_fetch will
copy the matched substring for us.

Signed-off-by: Ján Tomko <jto...@redhat.com>
---
 src/storage/storage_backend_logical.c | 49 +++++++--------------------
 1 file changed, 13 insertions(+), 36 deletions(-)

I'm getting a build failure with this patch:

../../src/storage/storage_backend_logical.c:128:11: error: variable 'p' set but 
not used [-Werror=unused-but-set-variable]
 128 |     char *p = NULL;

Oops, another case where GCC reports a slightly different set of
warnings than CLang.

Consider the following squashed in. Jano

diff --git a/src/storage/storage_backend_logical.c 
b/src/storage/storage_backend_logical.c
index d6c81e25b1..42dec05ba0 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -125,7 +125,6 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDefPtr 
vol,
    g_autoptr(GMatchInfo) info = NULL;
    int nextents, ret = -1;
    const char *regex_unit = "(\\S+)\\((\\S+)\\)";
-    char *p = NULL;
    size_t i;
    unsigned long long offset, size, length;
    virStorageVolSourceExtent extent;
@@ -186,8 +185,6 @@ virStorageBackendLogicalParseVolExtents(virStorageVolDefPtr 
vol,
        goto cleanup;
    }

-    p = groups[3];
-
    /* Each extent has a "path:offset" pair, and match #0
     * is the whole matched string.
     */

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to