diff options
author | Damjan Marion <damarion@cisco.com> | 2016-02-16 17:32:34 +0100 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2016-02-16 17:36:49 +0100 |
commit | d0386374d6759a3f056a604060140acd7c66926f (patch) | |
tree | 5f28c972377e9b2aef7d787a983d281653addada | |
parent | d8ff0e1dc7a1d7a6d24f16a5318b7fded908d2c5 (diff) |
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 <damarion@cisco.com>
-rw-r--r-- | vppinfra/vppinfra/vec.h | 27 |
1 files changed, 0 insertions, 27 deletions
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 |