[PATCHv2 3/4] Use 'unsigned int' rather than enum type for flag param

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

 



Setting an enum variable to a value that is not part of the enum
(as will happen when passing a bitwise-or flag param to
osinfo_product_foreach_related) is undefined behaviour in C.
---
 osinfo/osinfo_product.c         | 2 +-
 osinfo/osinfo_product_private.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/osinfo/osinfo_product.c b/osinfo/osinfo_product.c
index f81212d..35a4071 100644
--- a/osinfo/osinfo_product.c
+++ b/osinfo/osinfo_product.c
@@ -392,7 +392,7 @@ static OsinfoList *osinfo_list_append(OsinfoList *appendee,
  * upgrades or clones, or a combination of these, or none.
  */
 void osinfo_product_foreach_related(OsinfoProduct *product,
-                                    OsinfoProductForeachFlag flags,
+                                    unsigned int flags,
                                     OsinfoProductForeach foreach_func,
                                     gpointer user_data)
 {
diff --git a/osinfo/osinfo_product_private.h b/osinfo/osinfo_product_private.h
index b3c279d..c4ecdd5 100644
--- a/osinfo/osinfo_product_private.h
+++ b/osinfo/osinfo_product_private.h
@@ -36,7 +36,7 @@ typedef enum { /*< skip >*/
 } OsinfoProductForeachFlag;
 
 void osinfo_product_foreach_related(OsinfoProduct *product,
-                                    OsinfoProductForeachFlag flags,
+                                    unsigned int flags,
                                     OsinfoProductForeach foreach_func,
                                     gpointer user_data);
 
-- 
1.8.1.4

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux