projects
/
42
/
push_swap.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5646901
)
Fix is_sorted so it does not change its argument.
author
Lukas Jiriste
<ljiriste@student.42prague.com>
Fri, 23 Feb 2024 09:59:51 +0000
(10:59 +0100)
committer
Lukas Jiriste
<ljiriste@student.42prague.com>
Fri, 23 Feb 2024 09:59:51 +0000
(10:59 +0100)
src/is_sorted.c
patch
|
blob
|
history
diff --git
a/src/is_sorted.c
b/src/is_sorted.c
index 3029920140b1b12bd6930af114a43a257626a132..15e2a8803c476842e7eb174a34ecb969fe54e642 100644
(file)
--- a/
src/is_sorted.c
+++ b/
src/is_sorted.c
@@
-6,7
+6,7
@@
/* By: ljiriste <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/22 14:22:08 by ljiriste #+# #+# */
-/* Updated: 2024/02/2
2 14:37:15
by ljiriste ### ########.fr */
+/* Updated: 2024/02/2
3 10:58:13
by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
@@
-25,7
+25,10
@@
int is_sorted(t_stack *s)
{
cur = stack_top(s);
if (cur <= prev)
+ {
+ s->ind = start_ind;
return (0);
+ }
prev = cur;
stack_rotate(s, 1);
}