diff options
| author | nass1pro <nass1pro@gmail.com> | 2020-06-13 13:00:17 +0200 |
|---|---|---|
| committer | nass1pro <nass1pro@gmail.com> | 2020-06-13 13:00:17 +0200 |
| commit | cfb618b6e385a861db7f62141a5f13f211ca6f48 (patch) | |
| tree | f7f58c01cab975a3c31878acffd0ff194c4c96c3 /src | |
| parent | 38b4378cd29601395affad7832f15f6d71b7d6df (diff) | |
| download | minishell-cfb618b6e385a861db7f62141a5f13f211ca6f48.tar.gz minishell-cfb618b6e385a861db7f62141a5f13f211ca6f48.tar.bz2 minishell-cfb618b6e385a861db7f62141a5f13f211ca6f48.zip | |
Update of token_ferif_stick
Diffstat (limited to 'src')
| -rw-r--r-- | src/lexer/lexer.c | 5 | ||||
| -rw-r--r-- | src/lexer/token.c | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c index 92cd34a..47856c5 100644 --- a/src/lexer/lexer.c +++ b/src/lexer/lexer.c @@ -94,8 +94,9 @@ enum e_token_tag token_verif_stick(t_token *lst_token) i = ft_strlen(lst_token->content); - if (lst_token->content[i - 1] == ' ') - return(lst_token->tag); + if (i > 0) + if (lst_token->content[i - 1] == ' ') + return(lst_token->tag); return(lst_token->tag | LTAG_STICK); } diff --git a/src/lexer/token.c b/src/lexer/token.c index 6c6a184..490c7b1 100644 --- a/src/lexer/token.c +++ b/src/lexer/token.c @@ -12,9 +12,9 @@ #include "lexer.h" -t_token *token_new(enum e_token_tag tag, char *content) +t_token *token_new(enum e_token_tag tag, char *content) { - t_token *token; + t_token *token; if (content == NULL || (token = (t_token*)malloc(sizeof(t_token))) == NULL) @@ -28,7 +28,7 @@ t_token *token_new(enum e_token_tag tag, char *content) return token; } -void token_destroy(t_token *token) +void token_destroy(t_token *token) { free(token->content); free(token); |
