diff options
| -rw-r--r-- | libft/Makefile | 2 | ||||
| -rw-r--r-- | src/ft_m_loop.c | 9 | 
2 files changed, 8 insertions, 3 deletions
| diff --git a/libft/Makefile b/libft/Makefile index 858e90b..85f063d 100644 --- a/libft/Makefile +++ b/libft/Makefile @@ -121,7 +121,7 @@ OS			= $(shell uname)  #-------------------------------- Compiler ------------------------------------#  #==============================================================================#  ifeq (${OS}, Linux) -	CC		= gcc +	CC		= clang  else  	CC		= clang  endif diff --git a/src/ft_m_loop.c b/src/ft_m_loop.c index 6a05dd6..7c6259c 100644 --- a/src/ft_m_loop.c +++ b/src/ft_m_loop.c @@ -26,8 +26,11 @@ uint8_t  	int8_t	gnl;  	char	*prog;  	char	*buf; +	char	*fin; -    if (!(prog = malloc((quote - line) * sizeof(char)))) +    if (!(prog = ft_calloc(ft_strlen(line + 1), sizeof(char)))) +        return (0); +    if (!(fin = malloc((ft_strlen(prog) + ft_strlen(buf)) * sizeof(char))))          return (0);      ft_memcpy(prog, line, (quote - line));      buf = ft_strdup(line + (quote - line) + 1); @@ -39,9 +42,11 @@ uint8_t          ft_sprintf(buf + ft_strlen(buf), "\n%s", line);      }      buf = ft_strtrim(buf, "\"'"); -    ft_p_line(ft_strjoin(prog, buf), msh); +    fin = ft_strjoin(prog, buf); +    ft_p_line(fin, msh);      ft_memdel((void*)&line);      ft_memdel((void*)&buf); +    ft_memdel((void*)&fin);      ft_e_lcom(msh);      ft_lcom_clear(&msh->curr);      return (1); /*got second quote, keep going*/ | 
