From d0386374d6759a3f056a604060140acd7c66926f Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Tue, 16 Feb 2016 17:32:34 +0100 Subject: Remove vec_sort macro vec_sort macro was using gcc proprietary nested functions that require a executable stack and they are considered as unsafe. Also, nested functions are not supported by other compilers. vec_sort_with_function() should be used instead. Change-Id: I05959da63d222ec71c090ba63420b427ce10c79b Signed-off-by: Damjan Marion --- vppinfra/vppinfra/vec.h | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'vppinfra') diff --git a/vppinfra/vppinfra/vec.h b/vppinfra/vppinfra/vec.h index 79954f3dbd1..06080062b47 100644 --- a/vppinfra/vppinfra/vec.h +++ b/vppinfra/vppinfra/vec.h @@ -888,33 +888,6 @@ do { \ (_v(cmp) < 0 ? -1 : (_v(cmp) > 0 ? +1 : 0)); \ }) -/**\brief Sort a vector with qsort via user's comparison body - - Example to sort an integer vector: - int * int_vec = ...; - vec_sort (int_vec, i0, i1, i0[0] - i1[0]); - - WARNING: vec_sort requires an executable stack segment. - If at all possible, use vec_sort_with_function () instead. - - @param vec vector to sort - @param v0 vector element - @param v1 vector element - @param body vector comparision expression -*/ - -#define vec_sort(vec,v0,v1,body) \ -do { \ - int _vec_sort_compare (const void * _v0, \ - const void * _v1) \ - { \ - __typeof__ (vec) v0 = (__typeof__ (vec)) _v0; \ - __typeof__ (vec) v1 = (__typeof__ (vec)) _v1; \ - return (int) (body); \ - } \ - qsort (vec, vec_len (vec), sizeof (vec[0]), _vec_sort_compare); \ -} while (0) - /** \brief Sort a vector using the supplied element comparison function @param vec vector to sort -- cgit 1.2.3-korg