mirror of
				https://gitlab.com/klmp200/LO27.git
				synced 2025-10-31 10:53:04 +00:00 
			
		
		
		
	en fait il n'y avait pas de bug sur le point abordé ds le commit precedent, commence free matrix, necessite une mise au pt avec sli
This commit is contained in:
		| @@ -16,7 +16,6 @@ cellElement * CreateCellElem(){ | ||||
|  | ||||
| 	printf("---Created cellElement---\n"); | ||||
|  | ||||
| 	elem->value = true; | ||||
| 	elem->nextCol = NULL; | ||||
| 	elem->nextRow = NULL; | ||||
|  | ||||
| @@ -132,6 +131,8 @@ void FreeCellElement(cellElement* element) { | ||||
|  | ||||
| 	if (element != NULL){ | ||||
| 		free(element); | ||||
| 	}else{ | ||||
| 		printf("Cant free NULL"); | ||||
| 	} | ||||
| 	element = NULL; | ||||
| } | ||||
|   | ||||
| @@ -32,8 +32,6 @@ struct cellElement { | ||||
| 	int colIndex; | ||||
| 	int rowIndex; | ||||
|  | ||||
| 	bool value; | ||||
|  | ||||
| 	struct cellElement * nextCol; | ||||
| 	struct cellElement * nextRow; | ||||
|  | ||||
|   | ||||
| @@ -103,7 +103,7 @@ bool CreateMatrixElem(Matrix matrix, int ColPos, int RowPos){ | ||||
|  | ||||
|  | ||||
| 	if (error != 0){ | ||||
| 		free(elem); | ||||
| 		FreeCellElement(elem); | ||||
| 		return true; | ||||
| 	}else{ | ||||
| 		return false; | ||||
| @@ -246,4 +246,20 @@ void BasicPrintMatrix(Matrix matrix){ | ||||
| 	} | ||||
| 	 | ||||
| 	printf("---END OF MATRIX---\n\n"); | ||||
| } | ||||
| } | ||||
|  | ||||
| Matrix freeMatrix(Matrix matrix){ | ||||
| 	matrix.colCount = 0; | ||||
| 	matrix.rowCount = 0; | ||||
| 	/*il faut free les cellElements car FreeList ne peut pas le faire*/ | ||||
| 	FreeList(matrix.cols); | ||||
| 	FreeList(matrix.rows); | ||||
| 	return matrix; | ||||
| } | ||||
|  | ||||
| /* todos : | ||||
| *finir le freeMatrix | ||||
| *chasser les bugs | ||||
| *ecrire doc | ||||
| *faire un print + opti pour que sli l'adapte avec sdl | ||||
| */ | ||||
| @@ -79,5 +79,7 @@ Matrix SetMatrixDim(Matrix matrix,int nbCols,int nbRows); | ||||
|  | ||||
| void BasicPrintMatrix(Matrix matrix); | ||||
|  | ||||
| Matrix freeMatrix(Matrix matrix); | ||||
|  | ||||
| #endif | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user