repositories
/
TD_C.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
TP 13 exo1: Give more explicits name to callbacks
[TD_C.git]
/
TP_13
/
exo1
/
lib
/
io.c
diff --git
a/TP_13/exo1/lib/io.c
b/TP_13/exo1/lib/io.c
index 884d4a0b730f1d6e266628f326866a4e829112a2..e5a300070d24305638d8f140b866b480950a93d6 100644
(file)
--- a/
TP_13/exo1/lib/io.c
+++ b/
TP_13/exo1/lib/io.c
@@
-50,7
+50,7
@@
void do_sort(int array[], unsigned size) {
int errno = 0;
int choice = 0;
bool done = false;
int errno = 0;
int choice = 0;
bool done = false;
-
criteria_cb
criteria;
+
s_criteria_cb sort_
criteria;
printf("\n=== Menu de tri ===\n\n");
printf("1) Croissant.\n");
printf("\n=== Menu de tri ===\n\n");
printf("1) Croissant.\n");
@@
-68,23
+68,23
@@
void do_sort(int array[], unsigned size) {
} while (!done);
switch (choice) {
case 1:
} while (!done);
switch (choice) {
case 1:
- criteria = ascending;
+
sort_
criteria = ascending;
break;
case 2:
break;
case 2:
- criteria = descending;
+
sort_
criteria = descending;
break;
case 3:
break;
case 3:
- criteria = ascending_and_even;
+
sort_
criteria = ascending_and_even;
break;
case 4:
break;
case 4:
- criteria = ascending_and_odd;
+
sort_
criteria = ascending_and_odd;
break;
default:
/* sort ascending by default, unused code path */
break;
default:
/* sort ascending by default, unused code path */
- criteria = ascending;
+
sort_
criteria = ascending;
break;
}
break;
}
- sort_tab(array, size, criteria);
+ sort_tab(array, size,
sort_
criteria);
}
void do_count(int array[], unsigned size) {
}
void do_count(int array[], unsigned size) {
@@
-102,6
+102,8
@@
void do_resize(int array[], unsigned* old_size) {
errno = prompt_value("\nNouvelle taille?", (int*)&new_size);
handle_prompt_error(errno);
errno = prompt_value("\nNouvelle taille?", (int*)&new_size);
handle_prompt_error(errno);
+ /* FIXME: one should able the set the array new content if new_size > *old_size
+ * for now, new values are zeroed */
array = resize_tab(array, *old_size, new_size);
*old_size = new_size;
}
array = resize_tab(array, *old_size, new_size);
*old_size = new_size;
}