From: Jérôme Benoit Date: Fri, 10 Mar 2017 17:09:32 +0000 (+0100) Subject: TP 13 exo1: Rename the integer values swap function X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0139cafd72a74369bf88580c3a533ef923c97586;p=TD_C.git TP 13 exo1: Rename the integer values swap function Signed-off-by: Jérôme Benoit --- diff --git a/TP_13/exo1/lib/sort.c b/TP_13/exo1/lib/sort.c index aef713d..8b196ff 100644 --- a/TP_13/exo1/lib/sort.c +++ b/TP_13/exo1/lib/sort.c @@ -13,7 +13,7 @@ static bool sort_first(int* array, int length, criteria_cb criteria) { bool rt = false; for (int i = 0; i < length-1; i++) { if (criteria(array[i], array[i+1])) { - swap_int_ptr(&array[i], &array[i+1]); + swap_int(&array[i], &array[i+1]); if (!rt) { rt = true; }; } } diff --git a/TP_13/exo1/lib/utils.c b/TP_13/exo1/lib/utils.c index c48206f..04a20e4 100644 --- a/TP_13/exo1/lib/utils.c +++ b/TP_13/exo1/lib/utils.c @@ -1,6 +1,6 @@ #include "utils.h" -void swap_int_ptr(int* v1, int* v2) { +void swap_int(int* v1, int* v2) { int tmp = *v1; *v1 = *v2; *v2 = tmp; diff --git a/TP_13/exo1/lib/utils.h b/TP_13/exo1/lib/utils.h index 1acc243..03f1226 100644 --- a/TP_13/exo1/lib/utils.h +++ b/TP_13/exo1/lib/utils.h @@ -1,7 +1,9 @@ #ifndef UTILS_H #define UTILS_H -void swap_int_ptr(int* v1, int* v2); +#include "macros.h" + +void swap_int(int* v1, int* v2); void swap_ptr(void* v1, void* v2); #endif /* UTILS_H */ diff --git a/TP_13/exo1/src/main.c b/TP_13/exo1/src/main.c index 68b3008..06f5f8d 100644 --- a/TP_13/exo1/src/main.c +++ b/TP_13/exo1/src/main.c @@ -1,7 +1,5 @@ #include -#include "macros.h" - int main() { printf("Hello world\n");