[PATCH 3/3] syntax-check: Forbid use of qsort()

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

 



Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 build-aux/syntax-check.mk | 7 +++++++
 tools/nss/libvirt_nss.c   | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index 309ca0c29a..462bff72f8 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -248,6 +248,13 @@ sc_prohibit_canonicalize_file_name:
 	halt='use virFileCanonicalizePath() instead of canonicalize_file_name()' \
 	  $(_sc_search_regexp)
 
+# qsort from glibc is unstable. Use g_qsort_with_data from glib instead
+sc_prohibit_qsort:
+	@prohibit='\<qsort\(' \
+	exclude='exempt from syntax-check' \
+	halt='use g_qsort_with_data instead of qsort' \
+	  $(_sc_search_regexp)
+
 # Insist on correct types for [pug]id.
 sc_correct_id_types:
 	@prohibit='\<(int|long) *[pug]id\>' \
diff --git a/tools/nss/libvirt_nss.c b/tools/nss/libvirt_nss.c
index ff6ea1d373..d79a00a1b0 100644
--- a/tools/nss/libvirt_nss.c
+++ b/tools/nss/libvirt_nss.c
@@ -71,7 +71,8 @@ sortAddr(leaseAddress *tmpAddress,
          size_t ntmpAddress)
 {
     if (tmpAddress)
-        qsort(tmpAddress, ntmpAddress, sizeof(*tmpAddress), leaseAddressSorter);
+        qsort(tmpAddress, ntmpAddress, /* exempt from syntax-check */
+              sizeof(*tmpAddress), leaseAddressSorter);
 }
 
 
-- 
2.41.0
_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




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

  Powered by Linux