changed malloc, to ft_malloc. what have I done...
This commit is contained in:
parent
a5247bea82
commit
2c4eedb94f
30 changed files with 54 additions and 52 deletions
|
|
@ -121,6 +121,7 @@ math/ft_uitoa_base.c\
|
||||||
math/ft_ulltoa_base.c\
|
math/ft_ulltoa_base.c\
|
||||||
math/id.c\
|
math/id.c\
|
||||||
mem/ft_bzero.c\
|
mem/ft_bzero.c\
|
||||||
|
mem/ft_malloc.c\
|
||||||
mem/ft_memalloc.c\
|
mem/ft_memalloc.c\
|
||||||
mem/ft_memccpy.c\
|
mem/ft_memccpy.c\
|
||||||
mem/ft_memchr.c\
|
mem/ft_memchr.c\
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */
|
/* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 09:37:38 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:44:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
# define LIBFT_H
|
# define LIBFT_H
|
||||||
|
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
|
# include <errno.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
|
|
@ -64,6 +65,7 @@ int ft_vdprintf(int fd, const char *format, va_list ap);
|
||||||
int ft_asprintf(char **ret, const char *format, ...);
|
int ft_asprintf(char **ret, const char *format, ...);
|
||||||
int ft_vasprintf(char **ret, const char *format, va_list ap);
|
int ft_vasprintf(char **ret, const char *format, va_list ap);
|
||||||
|
|
||||||
|
void *ft_malloc(size_t size);
|
||||||
void *ft_memset(void *b, int c, size_t len);
|
void *ft_memset(void *b, int c, size_t len);
|
||||||
void ft_bzero(void *s, size_t n);
|
void ft_bzero(void *s, size_t n);
|
||||||
void *ft_memcpy(void *dst, const void *src, size_t n);
|
void *ft_memcpy(void *dst, const void *src, size_t n);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/08/16 13:43:51 by jhalford #+# #+# */
|
/* Created: 2016/08/16 13:43:51 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 00:35:44 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 15:43:50 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ t_btree *btree_create_node(void const *item, size_t content_size)
|
||||||
{
|
{
|
||||||
t_btree *new;
|
t_btree *new;
|
||||||
|
|
||||||
if (!(new = (t_btree *)malloc(sizeof(t_btree))))
|
if (!(new = (t_btree *)ft_malloc(sizeof(t_btree))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
new->left = 0;
|
new->left = 0;
|
||||||
new->right = 0;
|
new->right = 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 11:50:46 by jhalford #+# #+# */
|
/* Created: 2017/03/08 11:50:46 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 14:09:06 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:18 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ t_btree *btree_map(t_btree *root, void *(*f)(void *))
|
||||||
|
|
||||||
if (!root)
|
if (!root)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (!(new = (t_btree *)malloc(sizeof(*new))))
|
if (!(new = (t_btree *)ft_malloc(sizeof(*new))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
new->item = (*f)(root->item);
|
new->item = (*f)(root->item);
|
||||||
new->left = btree_map(root->left, f);
|
new->left = btree_map(root->left, f);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 13:27:20 by jhalford #+# #+# */
|
/* Created: 2016/11/07 13:27:20 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/12/07 17:35:12 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:43:50 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ t_dlist *ft_dlstnew(void const *content, size_t content_size)
|
||||||
|
|
||||||
if (!content)
|
if (!content)
|
||||||
{
|
{
|
||||||
new = malloc(sizeof(*new));
|
new = ft_malloc(sizeof(*new));
|
||||||
if (!new)
|
if (!new)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
new->content_size = 0;
|
new->content_size = 0;
|
||||||
|
|
@ -26,7 +26,7 @@ t_dlist *ft_dlstnew(void const *content, size_t content_size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new = (t_dlist *)malloc(sizeof(*new));
|
new = (t_dlist *)ft_malloc(sizeof(*new));
|
||||||
if (!new)
|
if (!new)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
new->content_size = content_size;
|
new->content_size = content_size;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 13:31:48 by jhalford #+# #+# */
|
/* Created: 2016/11/07 13:31:48 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 15:50:57 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@ char *ft_char_conversion(t_fmt *fmt, va_list ap)
|
||||||
char *ret;
|
char *ret;
|
||||||
|
|
||||||
(void)fmt;
|
(void)fmt;
|
||||||
ret = (char *)malloc(sizeof(char) + 1);
|
ret = (char *)ft_malloc(sizeof(char) + 1);
|
||||||
ret[0] = (char)va_arg(ap, int);
|
ret[0] = (char)va_arg(ap, int);
|
||||||
ret[1] = '\0';
|
ret[1] = '\0';
|
||||||
return (ret);
|
return (ret);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 13:33:27 by jhalford #+# #+# */
|
/* Created: 2016/11/07 13:33:27 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 15:20:08 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:28:56 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/20 15:52:57 by jhalford #+# #+# */
|
/* Created: 2017/03/20 15:52:57 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 15:19:56 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:29:36 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -56,8 +56,8 @@ int ft_vasprintf(char **ret, const char *format, va_list ap)
|
||||||
if (ft_fmtcalc(&final, &str, ap))
|
if (ft_fmtcalc(&final, &str, ap))
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
else
|
else if (!(final = ft_strjoin(final, (char[]){*str++, 0})))
|
||||||
final = ft_strjoin(final, (char[]){*str++, 0});
|
return (-1);
|
||||||
ft_strdel(&tmp);
|
ft_strdel(&tmp);
|
||||||
}
|
}
|
||||||
*ret = final;
|
*ret = final;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/07 13:33:35 by jhalford #+# #+# */
|
/* Created: 2016/11/07 13:33:35 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/10 16:54:40 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ t_fmt *ft_fmt_init(void)
|
||||||
{
|
{
|
||||||
t_fmt *fmt;
|
t_fmt *fmt;
|
||||||
|
|
||||||
fmt = (t_fmt *)malloc(sizeof(t_fmt) + 1);
|
fmt = (t_fmt *)ft_malloc(sizeof(t_fmt) + 1);
|
||||||
ft_bzero(fmt->flags, 6);
|
ft_bzero(fmt->flags, 6);
|
||||||
ft_bzero(fmt->modifier, 3);
|
ft_bzero(fmt->modifier, 3);
|
||||||
fmt->conversion = '\0';
|
fmt->conversion = '\0';
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/15 13:12:06 by jhalford #+# #+# */
|
/* Created: 2016/11/15 13:12:06 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 13:16:15 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:43:51 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/03/20 14:06:55 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,7 +18,7 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *))
|
||||||
|
|
||||||
if (!lst)
|
if (!lst)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
if (!(elem = (t_list *)malloc(sizeof(*elem))))
|
if (!(elem = (t_list *)ft_malloc(sizeof(*elem))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
elem->content = (*f)(lst->content);
|
elem->content = (*f)(lst->content);
|
||||||
elem->next = ft_lstmap(lst->next, f);
|
elem->next = ft_lstmap(lst->next, f);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/29 15:57:38 by jhalford #+# #+# */
|
/* Created: 2016/11/29 15:57:38 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 12:23:44 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:43:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ t_list *ft_lstnew(void const *content, size_t content_size)
|
||||||
{
|
{
|
||||||
t_list *new;
|
t_list *new;
|
||||||
|
|
||||||
if (!(new = (t_list *)malloc(sizeof(*new))))
|
if (!(new = (t_list *)ft_malloc(sizeof(*new))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
new->next = NULL;
|
new->next = NULL;
|
||||||
new->content_size = content_size;
|
new->content_size = content_size;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 14:57:25 by jhalford #+# #+# */
|
/* Created: 2016/11/03 14:57:25 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/06 15:41:01 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 15:43:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ void *ft_memalloc(size_t size)
|
||||||
void *addr;
|
void *addr;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
addr = malloc(size);
|
addr = ft_malloc(size);
|
||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/11 17:37:53 by jhalford #+# #+# */
|
/* Created: 2016/11/11 17:37:53 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/12/09 18:31:03 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:43:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 18:03:58 by jhalford #+# #+# */
|
/* Created: 2016/11/03 18:03:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/07 14:28:29 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 15:43:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/07 14:25:45 by jhalford #+# #+# */
|
/* Created: 2016/12/07 14:25:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/07 19:58:12 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ char **ft_sstrdup(char **list)
|
||||||
size = 0;
|
size = 0;
|
||||||
while (list[size])
|
while (list[size])
|
||||||
size++;
|
size++;
|
||||||
cpy = (char **)malloc(sizeof(char *) * (size + 1));
|
cpy = (char **)ft_malloc(sizeof(char *) * (size + 1));
|
||||||
while (*list)
|
while (*list)
|
||||||
{
|
{
|
||||||
cpy[i++] = ft_strdup(*list);
|
cpy[i++] = ft_strdup(*list);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 16:07:17 by jhalford #+# #+# */
|
/* Created: 2017/02/03 16:07:17 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 15:55:29 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ char *ft_strdupi_w(char const *s)
|
||||||
i = 0;
|
i = 0;
|
||||||
while (s[i] && s[i] != ' ' && s[i] != '\t')
|
while (s[i] && s[i] != ' ' && s[i] != '\t')
|
||||||
i++;
|
i++;
|
||||||
str = (char *)malloc(sizeof(char) * (i + 1));
|
str = (char *)ft_malloc(sizeof(char) * (i + 1));
|
||||||
if (str)
|
if (str)
|
||||||
{
|
{
|
||||||
str[i--] = '\0';
|
str[i--] = '\0';
|
||||||
|
|
@ -59,7 +59,7 @@ char **ft_split_whitespaces(char const *s)
|
||||||
str = NULL;
|
str = NULL;
|
||||||
if (!(s))
|
if (!(s))
|
||||||
return (str);
|
return (str);
|
||||||
str = (char **)malloc(sizeof(char *) * (ft_len_words(s) + 1));
|
str = (char **)ft_malloc(sizeof(char *) * (ft_len_words(s) + 1));
|
||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
if (!(str))
|
if (!(str))
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/07 14:25:41 by jhalford #+# #+# */
|
/* Created: 2016/12/07 14:25:41 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 08:27:05 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ char *ft_strdup(const char *s1)
|
||||||
{
|
{
|
||||||
char *dup;
|
char *dup;
|
||||||
|
|
||||||
if (!s1 || !(dup = (char*)malloc(sizeof(*dup) * (ft_strlen(s1) + 1))))
|
if (!s1 || !(dup = (char*)ft_malloc(sizeof(*dup) * (ft_strlen(s1) + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
ft_strcpy(dup, s1);
|
ft_strcpy(dup, s1);
|
||||||
return (dup);
|
return (dup);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 11:01:15 by ariard #+# #+# */
|
/* Created: 2017/03/07 11:01:15 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/07 11:24:27 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 15:43:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: ariard <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/06 13:37:12 by ariard #+# #+# */
|
/* Created: 2017/01/06 13:37:12 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/07 12:41:20 by ariard ### ########.fr */
|
/* Updated: 2017/03/21 15:43:52 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 14:58:24 by jhalford #+# #+# */
|
/* Created: 2016/11/03 14:58:24 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/03 14:58:25 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ char *ft_strmap(char const *s, char (*f)(char))
|
||||||
char *out;
|
char *out;
|
||||||
|
|
||||||
size = ft_strlen(s);
|
size = ft_strlen(s);
|
||||||
out = (char *)malloc(sizeof(char) * (size + 1));
|
out = (char *)ft_malloc(sizeof(char) * (size + 1));
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 14:58:28 by jhalford #+# #+# */
|
/* Created: 2016/11/03 14:58:28 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/03 14:58:29 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -19,7 +19,7 @@ char *ft_strmapi(char const *s, char (*f)(unsigned int, char))
|
||||||
char *out;
|
char *out;
|
||||||
|
|
||||||
size = ft_strlen(s);
|
size = ft_strlen(s);
|
||||||
out = (char *)malloc(sizeof(char) * (size + 1));
|
out = (char *)ft_malloc(sizeof(char) * (size + 1));
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 14:58:34 by jhalford #+# #+# */
|
/* Created: 2016/11/03 14:58:34 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/11 16:37:53 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ char *ft_strnew(size_t size)
|
||||||
char *addr;
|
char *addr;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
addr = (char *)malloc(size + 1);
|
addr = (char *)ft_malloc(size + 1);
|
||||||
if (addr == NULL)
|
if (addr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 14:58:40 by jhalford #+# #+# */
|
/* Created: 2016/11/03 14:58:40 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 16:10:24 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -49,7 +49,7 @@ char **ft_strsplit(char const *s, char c)
|
||||||
int k;
|
int k;
|
||||||
char **str2;
|
char **str2;
|
||||||
|
|
||||||
if (!s || !(str2 = (char **)malloc(sizeof(*str2) *
|
if (!s || !(str2 = (char **)ft_malloc(sizeof(*str2) *
|
||||||
(ft_countwords(s, c) + 1))))
|
(ft_countwords(s, c) + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 14:58:43 by jhalford #+# #+# */
|
/* Created: 2016/11/03 14:58:43 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 11:38:40 by gwojda ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ char *ft_strsub(char const *s, unsigned int start, size_t len)
|
||||||
char *out;
|
char *out;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (!(out = (char *)malloc(sizeof(char) * (len + 1))))
|
if (!(out = (char *)ft_malloc(sizeof(char) * (len + 1))))
|
||||||
return (NULL);
|
return (NULL);
|
||||||
i = -1;
|
i = -1;
|
||||||
while (++i < len)
|
while (++i < len)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/25 11:34:56 by jhalford #+# #+# */
|
/* Created: 2016/11/25 11:34:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/12/03 11:54:16 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:42:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ t_mytime *ft_mytime_get(time_t epoch)
|
||||||
char *date;
|
char *date;
|
||||||
t_mytime *time;
|
t_mytime *time;
|
||||||
|
|
||||||
time = (t_mytime*)malloc(sizeof(*time));
|
time = (t_mytime*)ft_malloc(sizeof(*time));
|
||||||
date = ctime(&epoch);
|
date = ctime(&epoch);
|
||||||
date[ft_strlen(date) - 1] = 0;
|
date[ft_strlen(date) - 1] = 0;
|
||||||
time->year = ft_isdigit(date[20]) ?
|
time->year = ft_isdigit(date[20]) ?
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/03 18:01:04 by jhalford #+# #+# */
|
/* Created: 2016/11/03 18:01:04 by jhalford #+# #+# */
|
||||||
/* Updated: 2016/11/25 11:43:52 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:44:24 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/03 11:57:53 by jhalford #+# #+# */
|
/* Created: 2016/12/03 11:57:53 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 15:23:49 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:28:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */
|
/* Created: 2016/11/28 14:28:41 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/21 14:48:13 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:49:14 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -25,8 +25,7 @@ int builtin_exit(const char *path, char *const av[], char *const envp[])
|
||||||
{
|
{
|
||||||
notified = 1;
|
notified = 1;
|
||||||
if (has_stopped_job() || has_running_job())
|
if (has_stopped_job() || has_running_job())
|
||||||
SH_ERR("There are running and/or stopped jobs");
|
return (SH_ERR("There are running and/or stopped jobs"));
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
if (av && av[1] && !ft_stris(av[1], ft_isdigit))
|
if (av && av[1] && !ft_stris(av[1], ft_isdigit))
|
||||||
SH_ERR(EXITERR_0);
|
SH_ERR(EXITERR_0);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/15 18:57:44 by ariard #+# #+# */
|
/* Created: 2017/02/15 18:57:44 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/20 10:35:11 by jhalford ### ########.fr */
|
/* Updated: 2017/03/21 15:46:51 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue