From 79c1f12169cf5d85b9f9e59e82cdf64aa7636111 Mon Sep 17 00:00:00 2001 From: Naej Date: Sun, 11 Dec 2016 00:33:02 +0100 Subject: [PATCH] added doc --- LibList/CellElement.c | 6 +----- LibList/CellElement.h | 46 ++++++++++++++++++++++++++++++++++++++++--- LibList/Makefile | 2 +- main.c | 1 + 4 files changed, 46 insertions(+), 9 deletions(-) diff --git a/LibList/CellElement.c b/LibList/CellElement.c index cc73a6f..70adfa1 100644 --- a/LibList/CellElement.c +++ b/LibList/CellElement.c @@ -23,11 +23,6 @@ cellElement * CreateCellElem(){ return elem; } -void freeCellElem(cellElement * elem){ - free(elem); - elem = NULL; -} - int AddNextCol(cellElement* tree){ cellElement * elem = NULL; @@ -117,4 +112,5 @@ void FreeCellElement(cellElement* element) { if (element != NULL){ free(element); } + element = NULL; } diff --git a/LibList/CellElement.h b/LibList/CellElement.h index 7a603b5..3efe146 100644 --- a/LibList/CellElement.h +++ b/LibList/CellElement.h @@ -39,17 +39,57 @@ struct cellElement { }; typedef struct cellElement cellElement; +/*---CreateCellElem--- +*Allocates a cellElement and returns it +* +*@return : pointer on the allocated cellElement +* +*/ cellElement * CreateCellElem(); -void freeCellElem(cellElement * elem); + +/*---AddNextCol--- +*Allocates a cellElement and sets it as the NextCol of the tree +* +*@tree : an allocated cellElement +* +*/ int AddNextCol(cellElement* tree); + + +/*---AddNextRow--- +*Allocates a cellElement and sets it as the NextRow of the tree +* +*@tree : an allocated cellElement +* +*/ int AddNextRow(cellElement* tree); -void removeNextCol(cellElement* list); -void removeNextRow(cellElement* list); +/*---removeNextCol--- +*Free the nextCol cellElement of the tree +* +*@tree : an allocated cellElement +* +*/ +void removeNextCol(cellElement* tree); + +/*---removeNextRow--- +*Free the nextRow cellElement of the tree +* +*@tree : an allocated cellElement +* +*/ +void removeNextRow(cellElement* tree); void recursivePrint(cellElement * tree); + +/*---FreeCellElem--- +*Allocates a cellElement and returns it +* +*@return : pointer on the allocated cellElement +* +*/ void FreeCellElement(cellElement* element); #endif diff --git a/LibList/Makefile b/LibList/Makefile index 05d8b08..5f92df2 100644 --- a/LibList/Makefile +++ b/LibList/Makefile @@ -2,7 +2,7 @@ CC=gcc CFLAGS=-Wall -Werror -pedantic -fpic -g -LIBSDIR=-L/usr/lib -L./Libs +LIBSDIR=-L/usr/lib -L../Libs INCLUDEDIR=-I/usr/include -I. #Library variables diff --git a/main.c b/main.c index b7c6daf..153d93a 100644 --- a/main.c +++ b/main.c @@ -12,6 +12,7 @@ #include int main(int argc, char **argv){ + cellElement * tree = NULL; tree = CreateCellElem(); tree->colIndex = 1;