mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
syntax-check: Forbid use of qsort()
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
cfcbba4c2b
commit
5dff94115c
@ -248,6 +248,13 @@ sc_prohibit_canonicalize_file_name:
|
||||
halt='use virFileCanonicalizePath() instead of canonicalize_file_name()' \
|
||||
$(_sc_search_regexp)
|
||||
|
||||
# qsort from glibc has unstable sort ordering for "equal" members
|
||||
sc_prohibit_qsort:
|
||||
@prohibit='\<(qsort|qsort_r) *\(' \
|
||||
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\>' \
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user