a few comments and code formatting in C code

This commit is contained in:
Tal Einat 2014-05-17 14:27:07 +03:00
parent ac836d9bf5
commit b96d483140
2 changed files with 13 additions and 3 deletions

View File

@ -23,13 +23,15 @@
static PyObject *
search_exact_byteslike(PyObject *self, PyObject *args) {
/* input params */
const char *subseq, *seq;
int subseq_len, seq_len;
PyObject *results = NULL;
PyObject *results;
PyObject *next_result;
void *next_match_ptr;
size_t next_match_index;
int subseq_sum;
void *next_match_ptr;
if (unlikely(!PyArg_ParseTuple(
args, "s#s#",
@ -39,6 +41,8 @@ search_exact_byteslike(PyObject *self, PyObject *args) {
return NULL;
}
/* this is required because simple_memmem_with_needle_sum() returns the
haystack if the needle is empty */
if (unlikely(subseq_len == 0)) {
PyErr_SetString(PyExc_ValueError, "subsequence must not be empty");
return NULL;
@ -90,8 +94,10 @@ error:
static PyObject *
count_differences_with_maximum_byteslike(PyObject *self, PyObject *args)
{
/* input params */
const char *seq1, *seq2;
int seq1_len, seq2_len, max_differences;
int i, n_differences;
if (!PyArg_ParseTuple(

View File

@ -10,9 +10,11 @@
static PyObject *
substitutions_only_has_near_matches_byteslike(PyObject *self, PyObject *args)
{
/* input params */
const char *subsequence;
const char *sequence;
int subseq_len, seq_len, max_substitutions;
unsigned int *sub_counts;
unsigned int seq_idx, subseq_idx, count_idx;
@ -29,8 +31,10 @@ substitutions_only_has_near_matches_byteslike(PyObject *self, PyObject *args)
Py_RETURN_FALSE;
}
/* this is required because simple_memmem_with_needle_sum() returns the
haystack if the needle is empty */
if (subseq_len == 0) {
PyErr_SetString(PyExc_ValueError, "Given subsequence is empty!");
PyErr_SetString(PyExc_ValueError, "subsequence must not be empty");
return NULL;
}