Skip to content

Commit

Permalink
pysqlite_statement_reset result() is never used => return void
Browse files Browse the repository at this point in the history
  • Loading branch information
Erlend E. Aasland committed Aug 25, 2021
1 parent 0633095 commit 06e242c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Modules/_sqlite/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ cursor_dealloc(pysqlite_Cursor *self)
PyObject_ClearWeakRefs((PyObject*)self);
}
if (self->statement) {
(void)pysqlite_statement_reset(self->statement);
pysqlite_statement_reset(self->statement);
}
tp->tp_clear((PyObject *)self);
tp->tp_free(self);
Expand Down Expand Up @@ -565,7 +565,7 @@ _pysqlite_query_execute(pysqlite_Cursor* self, int multiple, PyObject* operation
break;
}

(void)pysqlite_statement_reset(self->statement);
pysqlite_statement_reset(self->statement);
pysqlite_statement_mark_dirty(self->statement);

pysqlite_statement_bind_parameters(state, self->statement, parameters);
Expand Down
8 changes: 4 additions & 4 deletions Modules/_sqlite/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,19 +360,20 @@ pysqlite_statement_bind_parameters(pysqlite_state *state,
}
}

int pysqlite_statement_reset(pysqlite_Statement* self)
void
pysqlite_statement_reset(pysqlite_Statement *self)
{
sqlite3_stmt *stmt = self->st;
if (stmt == NULL || self->in_use == 0) {
return SQLITE_OK;
return;
}

#if SQLITE_VERSION_NUMBER >= 3020000
/* Check if the statement has been run (that is, sqlite3_step() has been
* called at least once). Third parameter is non-zero in order to reset the
* run count. */
if (sqlite3_stmt_status(stmt, SQLITE_STMTSTATUS_RUN, 1) == 0) {
return SQLITE_OK;
return;
}
#endif

Expand All @@ -384,7 +385,6 @@ int pysqlite_statement_reset(pysqlite_Statement* self)
if (rc == SQLITE_OK) {
self->in_use = 0;
}
return rc;
}

void pysqlite_statement_mark_dirty(pysqlite_Statement* self)
Expand Down
2 changes: 1 addition & 1 deletion Modules/_sqlite/statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void pysqlite_statement_bind_parameters(pysqlite_state *state,
pysqlite_Statement *self,
PyObject *parameters);

int pysqlite_statement_reset(pysqlite_Statement* self);
void pysqlite_statement_reset(pysqlite_Statement *self);
void pysqlite_statement_mark_dirty(pysqlite_Statement* self);

int pysqlite_statement_setup_types(PyObject *module);
Expand Down

0 comments on commit 06e242c

Please sign in to comment.