]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
debug: Turn mask unsigned
authorTobias Stoeckmann <tobias@stoeckmann.org>
Fri, 3 Apr 2026 08:16:48 +0000 (10:16 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Tue, 7 Apr 2026 09:52:43 +0000 (11:52 +0200)
The debug mask is a bitmask, so use an unsigned type. This also matches
the string formatters, since x/X expect an unsigned data type.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
include/debug.h
lib/debug.c
libmount/python/pylibmount.c
libmount/python/pylibmount.h

index fd53b676a246d23dd1ffc651cdfcae33aa0f2a3b..552f09759fd0448fb55364a8bd5a5f356df9d96f 100644 (file)
@@ -41,7 +41,7 @@
 
 struct ul_debug_maskname {
        const char *name;
-       int mask;
+       unsigned mask;
        const char *help;
 };
 #define UL_DEBUG_EMPTY_MASKNAMES {{ NULL, 0, NULL }}
@@ -49,7 +49,7 @@ struct ul_debug_maskname {
 #define UL_DEBUG_MASKNAMES(m)  m ## _masknames
 
 #define UL_DEBUG_MASK(m)         m ## _debug_mask
-#define UL_DEBUG_DEFINE_MASK(m)  int UL_DEBUG_MASK(m)
+#define UL_DEBUG_DEFINE_MASK(m)  unsigned UL_DEBUG_MASK(m)
 #define UL_DEBUG_DECLARE_MASK(m) extern UL_DEBUG_DEFINE_MASK(m)
 #define UL_DEBUG_ALL             0xFFFFFF
 
@@ -114,9 +114,9 @@ struct ul_debug_maskname {
 extern void ul_debug(const char *mesg, ...)
                __attribute__ ((__format__ (__printf__, 1, 2)));
 extern void ul_debug_prefix(const char *lib, const char *flag,
-                           const void *handler, int mask);
-extern int ul_debug_parse_mask(const struct ul_debug_maskname flagnames[],
-                              const char *mask);
+                           const void *handler, unsigned mask);
+extern unsigned ul_debug_parse_mask(const struct ul_debug_maskname flagnames[],
+                                   const char *mask);
 extern void ul_debug_print_masks(const char *env,
                                 const struct ul_debug_maskname flagnames[]);
 
index 21829d75f76a9127cd1abfcd7295d8cbaede2ab9..c76c51c4e213f9239718f8c09f6655b241ef0926 100644 (file)
@@ -21,17 +21,17 @@ void ul_debug(const char *mesg, ...)
 }
 
 void ul_debug_prefix(const char *lib, const char *flag,
-                    const void *handler, int mask)
+                    const void *handler, unsigned mask)
 {
        fprintf(stderr, "%d: %s: %8s: ", getpid(), lib, flag);
        if (handler && !(mask & __UL_DEBUG_FL_NOADDR))
                fprintf(stderr, "[%p]: ", handler);
 }
 
-int ul_debug_parse_mask(const struct ul_debug_maskname flagnames[],
-                       const char *mask)
+unsigned ul_debug_parse_mask(const struct ul_debug_maskname flagnames[],
+                            const char *mask)
 {
-       int res;
+       unsigned res;
        char *ptr;
 
        /* let's check for a numeric mask first */
index 5aac526cadae6f56e160f2dcff5a4a697655da5d..ff5b958295fb5a62996ae988a28ecb17f5850918 100644 (file)
@@ -21,7 +21,7 @@
 
 /* Libmount-specific Exception class */
 PyObject *LibmountError;
-int pylibmount_debug_mask;
+unsigned pylibmount_debug_mask;
 
 PyObject *UL_IncRef(void *killme)
 {
index bf3278defd6c65dea4fba117a51c524379570deb..9d1daff83ce3ef071be2b846a81a6cd610a8d3dd 100644 (file)
@@ -25,7 +25,7 @@
                                } \
                        } while (0)
 
-extern int pylibmount_debug_mask;
+extern unsigned pylibmount_debug_mask;
 
 static inline void __attribute__ ((__format__ (__printf__, 1, 2)))
 pymnt_debug(const char *mesg, ...)