This commit is contained in:
Valentin Moguérou 2023-10-22 15:17:31 +02:00
parent 78144a6a92
commit 0b9e63c0f0
2 changed files with 22 additions and 9 deletions

View File

@ -169,38 +169,43 @@ grille *creer_grille(int largeur)
g->positifs = malloc(g->n_positifs * sizeof(colonne*));
g->negatifs = malloc(g->n_negatifs * sizeof(colonne*));
/*
if (g->positifs == NULL || g->negatifs == NULL)
{
free(g->positifs);
free(g->negatifs);
free(g);
return NULL;
}
bool echec_allocation = false;
*/
for (int i=0; i < g->n_positifs; i++)
{
g->positifs[i] = creer_colonne(Y_BLOCK_SIZE);
if (g->positifs[i] == NULL)
echec_allocation = true;
//if (g->positifs[i] == NULL)
// echec_allocation = true;
}
for (int i=0; i < g->n_negatifs; i++)
{
g->negatifs[i] = creer_colonne(Y_BLOCK_SIZE);
if (g->negatifs[i] == NULL)
echec_allocation = true;
//if (g->negatifs[i] == NULL)
// echec_allocation = true;
}
// si une colonne n'a pas pu être crée, on détruit la grille
if (echec_allocation)
/*
if (echec_allocation)
{
detruire_grille(g);
g = NULL;
return NULL;
}
*/
return g;
return g;
}

8
main.c Normal file
View File

@ -0,0 +1,8 @@
#include "grille.h"
#include "display.h"
int main(int argc, char **argv)
{
return 0;
}