]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
blkid: fix -Wunused-but-set-variable warning in blkid_read_cache()
authorTheodore Ts'o <tytso@mit.edu>
Thu, 28 Mar 2024 17:33:04 +0000 (13:33 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 28 Mar 2024 17:33:04 +0000 (13:33 -0400)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/blkid/blkidP.h
lib/blkid/read.c

index 68ea5724fc5eecc99b3c1c6949370c6988734a3d..dad8bfbbfb4e395f698dc2d79057308136e1bdb7 100644 (file)
@@ -152,8 +152,10 @@ extern char *blkid_strndup(const char *s, const int length);
 #include <stdio.h>
 extern int     blkid_debug_mask;
 #define DBG(m,x)       if ((m) & blkid_debug_mask) x;
+#define INC_LINENO     lineno++
 #else
 #define DBG(m,x)
+#define INC_LINENO
 #endif
 
 #ifdef CONFIG_BLKID_DEBUG
index b8948564c0d3a8660873d41cac9725b7c243c676..ad4f44f0aee14856dad38da8ae3e840a4958da80 100644 (file)
@@ -382,7 +382,10 @@ void blkid_read_cache(blkid_cache cache)
 {
        FILE *file;
        char buf[4096];
-       int fd, lineno = 0;
+       int fd;
+#ifdef CONFIG_BLKID_DEBUG
+       int lineno = 0;
+#endif
        struct stat st;
 
        if (!cache)
@@ -414,7 +417,7 @@ void blkid_read_cache(blkid_cache cache)
                blkid_dev dev;
                unsigned int end;
 
-               lineno++;
+               INC_LINENO;
                if (buf[0] == 0)
                        continue;
                end = strlen(buf) - 1;
@@ -422,7 +425,7 @@ void blkid_read_cache(blkid_cache cache)
                while (buf[end] == '\\' && end < sizeof(buf) - 2 &&
                       fgets(buf + end, sizeof(buf) - end, file)) {
                        end = strlen(buf) - 1;
-                       lineno++;
+                       INC_LINENO;
                }
 
                if (blkid_parse_line(cache, &dev, buf) < 0) {