Address C compiler warnings (#4885)

* Initialize variables with dummy values to silence warnings

* Fix indentation to silence warnings

* Initialize pointers to NULL to silence warnings
This commit is contained in:
Michael M.
2024-11-19 23:31:17 -06:00
committed by GitHub
parent e70e66030b
commit 68dc8b6463
2 changed files with 51 additions and 46 deletions

View File

@ -5636,9 +5636,9 @@ exit: \
const double epsilon = self->epsilon; \
Trace** M; \
TraceGapsWatermanSmithBeyer** gaps; \
double** M_row; \
double** Ix_row; \
double** Iy_row; \
double** M_row = NULL; \
double** Ix_row = NULL; \
double** Iy_row = NULL; \
int ng; \
int nm; \
double score; \
@ -5999,8 +5999,13 @@ exit: \
* expanded nodes, lower_bound contains the global lower_bound, a and b \
* contain the lower bounds for the current cell. ch contains the types of \
* the potential children */ \
int type_total = 1, new_type, npA, npB; \
double new_score, new_lower, new_upper, next_lower, next_upper; \
int type_total = 1; \
/* The initial values for new_type, npA, npB, new_score, new_lower, \
new_upper, next_lower, and next_upper don't mean anything; they're never \
used and are only initialized to stop compiler warnings */ \
int new_type = 0, npA = 0, npB = 0; \
double new_score = 0, new_lower = 0, new_upper = 0, next_lower = 0, \
next_upper = 0; \
const double gap_open_A = self->target_internal_open_gap_score; \
const double gap_open_B = self->query_internal_open_gap_score; \
const double gap_extend_A = self->target_internal_extend_gap_score; \

View File

@ -340,52 +340,52 @@ static PyObject *cpairwise2__make_score_matrix_fast(PyObject *self,
best_score = local_max_score;
/* Save the score and traceback matrices into real python objects. */
if(!score_only) {
if(!(py_score_matrix = PyList_New(lenA+1)))
goto _cleanup_make_score_matrix_fast;
if(!(py_trace_matrix = PyList_New(lenA+1)))
goto _cleanup_make_score_matrix_fast;
if(!score_only) {
if(!(py_score_matrix = PyList_New(lenA+1)))
goto _cleanup_make_score_matrix_fast;
if(!(py_trace_matrix = PyList_New(lenA+1)))
goto _cleanup_make_score_matrix_fast;
for(row=0; row<=lenA; row++) {
PyObject *py_score_row, *py_trace_row;
if(!(py_score_row = PyList_New(lenB+1)))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_score_matrix, row, py_score_row);
if(!(py_trace_row = PyList_New(lenB+1)))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_trace_matrix, row, py_trace_row);
for(row=0; row<=lenA; row++) {
PyObject *py_score_row, *py_trace_row;
if(!(py_score_row = PyList_New(lenB+1)))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_score_matrix, row, py_score_row);
if(!(py_trace_row = PyList_New(lenB+1)))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_trace_matrix, row, py_trace_row);
for(col=0; col<=lenB; col++) {
PyObject *py_score, *py_trace;
int offset = row*(lenB+1) + col;
for(col=0; col<=lenB; col++) {
PyObject *py_score, *py_trace;
int offset = row*(lenB+1) + col;
/* Set py_score_matrix[row][col] to the score. */
if(!(py_score = PyFloat_FromDouble(score_matrix[offset])))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_score_row, col, py_score);
/* Set py_score_matrix[row][col] to the score. */
if(!(py_score = PyFloat_FromDouble(score_matrix[offset])))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_score_row, col, py_score);
/* Set py_trace_matrix[row][col] to a list of indexes. On
the edges of the matrix (row or column is 0), the
matrix should be [None]. */
if(!row || !col) {
if(!(py_trace = Py_BuildValue("B", 1)))
goto _cleanup_make_score_matrix_fast;
Py_INCREF(Py_None);
PyList_SET_ITEM(py_trace_row, col, Py_None);
}
else {
if(!(py_trace = Py_BuildValue("B", trace_matrix[offset])))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_trace_row, col, py_trace);
/* Set py_trace_matrix[row][col] to a list of indexes. On
the edges of the matrix (row or column is 0), the
matrix should be [None]. */
if(!row || !col) {
if(!(py_trace = Py_BuildValue("B", 1)))
goto _cleanup_make_score_matrix_fast;
Py_INCREF(Py_None);
PyList_SET_ITEM(py_trace_row, col, Py_None);
}
else {
if(!(py_trace = Py_BuildValue("B", trace_matrix[offset])))
goto _cleanup_make_score_matrix_fast;
PyList_SET_ITEM(py_trace_row, col, py_trace);
}
}
}
}
else {
py_score_matrix = PyList_New(1);
py_trace_matrix = PyList_New(1);
}
}
}
}
}
else {
py_score_matrix = PyList_New(1);
py_trace_matrix = PyList_New(1);
}
py_retval = Py_BuildValue("(OOd)", py_score_matrix, py_trace_matrix, best_score);
_cleanup_make_score_matrix_fast: