Directory: | ./ |
---|---|
File: | s21_remove_matrix.c |
Date: | 2025-08-15 23:01:21 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 12 | 12 | 100.0% |
Branches: | 8 | 8 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "s21_matrix.h" | ||
2 | |||
3 | 414 | void s21_remove_matrix(matrix_t *A) { | |
4 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 412 times.
|
414 | if (A == NULL) { |
5 | 2 | return; | |
6 | } | ||
7 | |||
8 |
2/2✓ Branch 0 taken 406 times.
✓ Branch 1 taken 6 times.
|
412 | if (A->matrix != NULL) { |
9 |
2/2✓ Branch 0 taken 1176 times.
✓ Branch 1 taken 406 times.
|
1582 | for (int i = 0; i < A->rows; i++) { |
10 |
2/2✓ Branch 0 taken 1172 times.
✓ Branch 1 taken 4 times.
|
1176 | if (A->matrix[i] != NULL) { |
11 | 1172 | free(A->matrix[i]); | |
12 | 1172 | A->matrix[i] = NULL; | |
13 | } | ||
14 | } | ||
15 | 406 | free(A->matrix); | |
16 | } | ||
17 | |||
18 | 412 | A->matrix = NULL; | |
19 | 412 | A->rows = 0; | |
20 | 412 | A->columns = 0; | |
21 | } | ||
22 |