bueff changee en buffer

This commit is contained in:
Hugo LAMY
2019-12-16 14:22:26 +01:00
parent 2346a5aff7
commit 9e0d8f65f9
2 changed files with 6 additions and 6 deletions

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */ /* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/11 00:27:09 by hulamy #+# #+# */ /* Created: 2019/12/11 00:27:09 by hulamy #+# #+# */
/* Updated: 2019/12/16 13:54:20 by hulamy ### ########.fr */ /* Updated: 2019/12/16 14:21:00 by hulamy ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -128,7 +128,7 @@ void free_lst(t_gnlist **lst, const int fd)
int get_next_line(const int fd, char **line) int get_next_line(const int fd, char **line)
{ {
char buf[BUFF_SIZE + 1]; char buf[BUFFER_SIZE + 1];
int ret; int ret;
static t_gnlist *lst = NULL; static t_gnlist *lst = NULL;
char *str; char *str;
@@ -139,7 +139,7 @@ int get_next_line(const int fd, char **line)
{ {
if ((str = ft_strchr(lst->string, '\n'))) if ((str = ft_strchr(lst->string, '\n')))
return (hasnewline(str, lst, line)); return (hasnewline(str, lst, line));
if ((ret = read(fd, buf, BUFF_SIZE)) < 0) if ((ret = read(fd, buf, BUFFER_SIZE)) < 0)
return (-1); return (-1);
buf[ret] = '\0'; buf[ret] = '\0';
if (!(lst->string = ft_strjoinfree(lst->string, buf))) if (!(lst->string = ft_strjoinfree(lst->string, buf)))

View File

@@ -6,7 +6,7 @@
/* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */ /* By: hulamy <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/12/16 14:08:36 by hulamy #+# #+# */ /* Created: 2019/12/16 14:08:36 by hulamy #+# #+# */
/* Updated: 2019/12/16 14:10:35 by hulamy ### ########.fr */ /* Updated: 2019/12/16 14:21:34 by hulamy ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -128,7 +128,7 @@ void free_lst(t_gnlist **lst, const int fd)
int get_next_line(const int fd, char **line) int get_next_line(const int fd, char **line)
{ {
char buf[BUFF_SIZE + 1]; char buf[BUFFER_SIZE + 1];
int ret; int ret;
static t_gnlist *lst = NULL; static t_gnlist *lst = NULL;
char *str; char *str;
@@ -139,7 +139,7 @@ int get_next_line(const int fd, char **line)
{ {
if ((str = ft_strchr(lst->string, '\n'))) if ((str = ft_strchr(lst->string, '\n')))
return (hasnewline(str, lst, line)); return (hasnewline(str, lst, line));
if ((ret = read(fd, buf, BUFF_SIZE)) < 0) if ((ret = read(fd, buf, BUFFER_SIZE)) < 0)
return (-1); return (-1);
buf[ret] = '\0'; buf[ret] = '\0';
if (!(lst->string = ft_strjoinfree(lst->string, buf))) if (!(lst->string = ft_strjoinfree(lst->string, buf)))