42shpimanmls / 42sh

Shell project at 42
3 stars 0 forks source link

[mod] libft: tablen: do not return '-1' if chart is NULL. #128

Closed M5oul closed 7 years ago

M5oul commented 7 years ago

It won't affect other functions:

grep -rn "ft_tablen(" srcs/ | grep -v Fichier
srcs/init/init.c:20:        if (line && ft_tablen(line) == 2 &&
srcs/execution/execute_builtin.c:26:        ret = builtin->builtin(ft_tablen(cmd->argv), cmd->argv);
srcs/execution/builtins/tabenv.c:42:    nenv = (char**)memalloc_or_die(sizeof(char*) * (ft_tablen(env) + 2));
srcs/execution/builtins/tabenv.c:67:    nenv = (char**)memalloc_or_die(sizeof(char*) * (ft_tablen(env) + 1));

I need it it to allocate memory with two upper lines. If it return -1 the allocated memory space is not enough.