Skip to content

Commit

Permalink
Minor sqlite3 cleanups (#13141)
Browse files Browse the repository at this point in the history
* Remove always-true stmt_obj->db_obj condition

This is always true because SQLITE3_CHECK_INITIALIZED checks this.

* Remove always-true param_number check

This is always true because we return early when the value < 1.
  • Loading branch information
nielsdos authored Jan 13, 2024
1 parent a3a3186 commit d463d21
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ext/sqlite3/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1427,9 +1427,7 @@ PHP_METHOD(SQLite3Stmt, close)

SQLITE3_CHECK_INITIALIZED(stmt_obj->db_obj, stmt_obj->initialised, SQLite3);

if(stmt_obj->db_obj) {
zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlite3_compare_stmt_zval_free);
}
zend_llist_del_element(&(stmt_obj->db_obj->free_list), object, (int (*)(void *, void *)) php_sqlite3_compare_stmt_zval_free);

RETURN_TRUE;
}
Expand Down Expand Up @@ -1682,9 +1680,7 @@ static int register_bound_parameter_to_sqlite(struct php_sqlite3_bound_param *pa
return 0;
}

if (param->param_number >= 1) {
zend_hash_index_del(hash, param->param_number);
}
zend_hash_index_del(hash, param->param_number);

if (param->name) {
zend_hash_update_mem(hash, param->name, param, sizeof(struct php_sqlite3_bound_param));
Expand Down

0 comments on commit d463d21

Please sign in to comment.