diff options
Diffstat (limited to 'src/helper_functions.c')
| -rw-r--r-- | src/helper_functions.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/helper_functions.c b/src/helper_functions.c index 162cf45..cd35848 100644 --- a/src/helper_functions.c +++ b/src/helper_functions.c @@ -16,6 +16,15 @@ void *malloce(size_t size){ return mal; } +void *realloce(void* mal,size_t size){ + mal=realloc(mal,size); + if(!mal){ + fprintf(stderr, "lsh: allocation error\n"); + exit(EXIT_FAILURE); + } + return mal; +} + char *pop(char *token, int ch_i){ if(token[ch_i]=='\0'){ return token; @@ -83,7 +92,7 @@ char *basename(char *path_in) { char *token = NULL; char *lastToken = NULL; - char *basePath; + char *basePath = NULL; basePath = (char *)malloce(sizeof(char) * (strlen(path_in) + 1)); strcpy(basePath, path_in); |
