modif
This commit is contained in:
parent
78144a6a92
commit
0b9e63c0f0
15
grille.c
15
grille.c
@ -169,36 +169,41 @@ 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)
|
||||
{
|
||||
detruire_grille(g);
|
||||
g = NULL;
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
|
||||
return g;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user