42-archive/42sh/srcs/lexer/token_append.c
2017-01-26 19:24:00 +01:00

24 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* token_append.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/11 17:18:42 by jhalford #+# #+# */
/* Updated: 2016/11/11 17:47:15 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
#include "lexer.h"
int token_append(t_token *token, char c)
{
if ((int)ft_strlen(token->data) >= token->size)
{
token->data = (char *)ft_realloc(token->data, token->size + 10);
token->size += 10;
}
ft_strcat(token->data, (char[2]){c, '\0'});
return (0);
}