2 files changed, +5, -8
80bfa17refactor(stack_push_bottom): remove bounds check (impossible error since we know the size in parse_args)
include/stack.h
+3, -3
+3, -3
@@ -6,7 +6,7 @@
6 6 /* By: mleitao <mleitao@student.42.fr> +#+ +:+ +#+ */
7 7 /* +#+#+#+#+#+ +#+ */
8 8 /* Created: 2026/04/21 23:34:55 by mleitao #+# #+# */
9 -/* Updated: 2026/04/22 20:01:51 by mleitao ### ########.fr */
9+/* Updated: 2026/04/28 10:06:33 by ohaponiu ### ########.fr */
1010 /* */
1111 /* ************************************************************************** */
1212
@@ -37,7 +37,7 @@ void stack_push(t_stack *dst, t_stack *src);
3737 void stack_rotate(t_stack *s);
3838 void stack_rev_rotate(t_stack *s);
3939
40 -/* ingest */
41 -int stack_push_bottom(t_stack *s, int value);
40+/* init helper */
41+void stack_push_bottom(t_stack *s, int value);
4242
4343 #endif
@@ -6,17 +6,14 @@
6 6 /* By: ohaponiu <marvin@42.fr> +#+ +:+ +#+ */
7 7 /* +#+#+#+#+#+ +#+ */
8 8 /* Created: 2026/04/23 12:54:23 by ohaponiu #+# #+# */
9 -/* Updated: 2026/04/24 01:17:28 by ohaponiu ### ########.fr */
9+/* Updated: 2026/04/28 09:56:56 by ohaponiu ### ########.fr */
1010 /* */
1111 /* ************************************************************************** */
1212
1313 #include <stack.h>
1414
15 -int stack_push_bottom(t_stack *s, int value)
15+void stack_push_bottom(t_stack *s, int value)
1616 {
17 - if (s->size >= s->capacity)
18 - return (-1);
1917 s->buf[(s->head + s->size) % s->capacity] = value;
2018 s->size++;
21 - return (0);
2219 }