push and pop changed
This commit is contained in:
parent
0e9ac5bbb9
commit
ee6038a4b1
7 changed files with 13 additions and 10 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */
|
/* Created: 2016/11/07 13:27:46 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/10 00:32:53 by jhalford ### ########.fr */
|
/* Updated: 2017/03/03 13:36:18 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ struct s_list
|
||||||
|
|
||||||
typedef struct s_list t_list;
|
typedef struct s_list t_list;
|
||||||
|
|
||||||
t_list *pop(t_list **lst);
|
int pop(t_list **lst);
|
||||||
t_list *push(t_list **stack, int elem);
|
t_list *push(t_list **stack, int elem);
|
||||||
|
|
||||||
t_list *ft_lstnew(void const *content, size_t content_size);
|
t_list *ft_lstnew(void const *content, size_t content_size);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/04 11:08:55 by jhalford #+# #+# */
|
/* Created: 2016/11/04 11:08:55 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/04 11:10:25 by jhalford ### ########.fr */
|
/* Updated: 2017/03/02 17:47:34 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/04 11:09:17 by jhalford #+# #+# */
|
/* Created: 2016/11/04 11:09:17 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/09 12:33:31 by jhalford ### ########.fr */
|
/* Updated: 2017/03/02 17:47:26 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/05 13:39:33 by jhalford #+# #+# */
|
/* Created: 2016/12/05 13:39:33 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/12/05 13:43:03 by jhalford ### ########.fr */
|
/* Updated: 2017/03/03 13:34:45 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 14:57:21 by jhalford #+# #+# */
|
/* Created: 2016/11/03 14:57:21 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/09 12:30:20 by jhalford ### ########.fr */
|
/* Updated: 2017/03/02 17:48:58 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,18 +6,21 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/04 11:09:56 by jhalford #+# #+# */
|
/* Created: 2016/11/04 11:09:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/10 00:33:21 by jhalford ### ########.fr */
|
/* Updated: 2017/03/03 16:49:59 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "libft.h"
|
#include "libft.h"
|
||||||
|
|
||||||
t_list *pop(t_list **lst)
|
int pop(t_list **lst)
|
||||||
{
|
{
|
||||||
t_list *top;
|
t_list *top;
|
||||||
|
int item;
|
||||||
|
|
||||||
top = *lst;
|
top = *lst;
|
||||||
|
item = top ? *(int*)top->content : 0;
|
||||||
if (lst && *lst)
|
if (lst && *lst)
|
||||||
*lst = (*lst)->next;
|
*lst = (*lst)->next;
|
||||||
return (top);
|
ft_lstdelone(&top, ft_lst_cfree);
|
||||||
|
return (item);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 15:59:39 by jhalford #+# #+# */
|
/* Created: 2017/02/09 15:59:39 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/20 17:19:25 by jhalford ### ########.fr */
|
/* Updated: 2017/03/02 20:59:42 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue