1
0
mirror of https://gitlab.com/klmp200/LO27.git synced 2024-11-22 22:13:19 +00:00

fix suppr

This commit is contained in:
Naej 2016-12-24 13:39:14 +01:00
parent 6d3043902c
commit 0a6c7524e0

View File

@ -128,7 +128,11 @@ int SupprMatrixElem(Matrix matrix, int ColPos, int RowPos){
} }
Row = GetElementPos(matrix.rows,RowPos); Row = GetElementPos(matrix.rows,RowPos);
if (Row == NULL || Row->data == NULL){ if (Row == NULL){
return -1;
}
if (Row->data == NULL){
RemoveElementPos(matrix.rows,RowPos);
return -1; return -1;
} }
@ -146,12 +150,19 @@ int SupprMatrixElem(Matrix matrix, int ColPos, int RowPos){
} }
} }
if (Row->data == NULL){
RemoveElementPos(matrix.rows,RowPos);
}
Col = GetElementPos(matrix.cols,ColPos); Col = GetElementPos(matrix.cols,ColPos);
if (Col == NULL|| Col->data == NULL){ if (Col == NULL){
return -2; return -2;
} }
if (Col->data == NULL){
RemoveElementPos(matrix.cols,ColPos);
return -1;
}
if (Col->data->rowIndex == RowPos){ if (Col->data->rowIndex == RowPos){
Col->data = elem->nextRow; Col->data = elem->nextRow;
} else { } else {
@ -163,10 +174,12 @@ int SupprMatrixElem(Matrix matrix, int ColPos, int RowPos){
return -4; /* WTF ?? */ return -4; /* WTF ?? */
} else { } else {
tmp->nextRow = elem->nextRow; tmp->nextRow = elem->nextRow;
} }
} }
if (Col->data == NULL){
RemoveElementPos(matrix.cols,ColPos);
}
FreeCellElement(elem); FreeCellElement(elem);
return 1; return 1;