on traque les fuites mémoires de SATAN

This commit is contained in:
Aethor 2017-05-28 16:35:35 +02:00
parent 2a7dad2662
commit 99545a8d41
3 changed files with 11 additions and 12 deletions

View File

@ -1,4 +1,4 @@
// Created by Aethor
// Created by Arthur Amalvy
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
@ -8,7 +8,7 @@
WordList * fishExpand(WordList *wordList) {
if(wordList->size > 1){
/*if(wordList->size > 1){
int i;
WordList* newWordList = createWordList();// creating the list to return
@ -45,7 +45,8 @@ WordList * fishExpand(WordList *wordList) {
}
else return wordList;
else return wordList;*/
return wordList;
}
@ -61,14 +62,14 @@ WordList* expandWord(char* word){
WordArray * getFiles(char* path){
WordList* getFiles(char* path){
DIR* directory;
dirent* dir;
int i = 0;
WordArray* files = (WordArray*) malloc(sizeof(WordArray));
WordList* files = createWordList();
if((directory = opendir(path)) != NULL){
@ -79,8 +80,6 @@ WordArray * getFiles(char* path){
}
files->words = (char **) malloc(sizeof(char*) * (i + 1));
closedir(directory);
directory = opendir(path);
i = 0;
@ -89,13 +88,13 @@ WordArray * getFiles(char* path){
if(!strcmp(dir->d_name, ".") && !strcmp(dir->d_name, "..")){
printf("%s\n", dir->d_name);
files->words[i] = dir->d_name;
printf("%s\n", dir->d_name);//test
addEndWordList(files, dir->d_name);
i++;
files->size++;
}
}

View File

@ -6,7 +6,7 @@ typedef struct dirent dirent;
WordList * fishExpand(WordList *wordArray);
WordArray* getFiles(char* path);
WordList* getFiles(char* path);
WordList* expandWord(char* word);

View File

@ -117,7 +117,7 @@ void freeWordList(WordList *list) {
free(list);
}
void concatWordList(WordList* list1, WordList* list2){//return a sing list containing all elements of both lists
void concatWordList(WordList* list1, WordList* list2){//return a single list containing all elements of both lists
if(list1 == NULL || list2 == NULL){
crash();