Enrico Scholz
2012-08-26 11:44:59 UTC
random(3) is marked deprecated and requires the _BSD_SOURCE feature.
Use rand(3) instead of which is an alias of random(3). With old code,
build failed with:
| lib/qsort.c: In function 'quicksort':
| lib/qsort.c:33:3: error: implicit declaration of function 'random' [-Werror=implicit-function-declaration]
| cc1: some warnings being treated as errors
Signed-off-by: Enrico Scholz <***@informatik.tu-chemnitz.de>
---
lib/qsort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/qsort.c b/lib/qsort.c
index 8c24b77..2523d5d 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -30,7 +30,7 @@ static void quicksort(char* base,size_t size,ssize_t l,ssize_t r,
data is already sorted. Try to improve by exchanging it with a
random other pivot.
*/
- exch(base,size,l+(random()%(r-l)),r);
+ exch(base,size,l+(rand()%(r-l)),r);
#elif defined MID
/*
We chose the rightmost element in the array to be sorted as pivot,
Use rand(3) instead of which is an alias of random(3). With old code,
build failed with:
| lib/qsort.c: In function 'quicksort':
| lib/qsort.c:33:3: error: implicit declaration of function 'random' [-Werror=implicit-function-declaration]
| cc1: some warnings being treated as errors
Signed-off-by: Enrico Scholz <***@informatik.tu-chemnitz.de>
---
lib/qsort.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/qsort.c b/lib/qsort.c
index 8c24b77..2523d5d 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -30,7 +30,7 @@ static void quicksort(char* base,size_t size,ssize_t l,ssize_t r,
data is already sorted. Try to improve by exchanging it with a
random other pivot.
*/
- exch(base,size,l+(random()%(r-l)),r);
+ exch(base,size,l+(rand()%(r-l)),r);
#elif defined MID
/*
We chose the rightmost element in the array to be sorted as pivot,
--
1.7.11.4
1.7.11.4