Removed unneeded if statements

This commit is contained in:
Maas-Maarten Zeeman
2017-03-01 08:48:11 +01:00
parent d4969140bc
commit aefc294613

View File

@@ -222,24 +222,21 @@ destruct_esqlite_connection(ErlNifEnv *env, void *arg)
/* The thread has finished... now remove the command queue, and close /* The thread has finished... now remove the command queue, and close
* the database (if it was still open). * the database (if it was still open).
*/ */
while(queue_has_item(db->commands)) command_destroy(queue_pop(db->commands)); while(queue_has_item(db->commands)) {
command_destroy(queue_pop(db->commands));
}
queue_destroy(db->commands); queue_destroy(db->commands);
if(db->db) { sqlite3_close_v2(db->db);
sqlite3_close_v2(db->db); db->db = NULL;
db->db = NULL;
}
} }
static void static void
destruct_esqlite_statement(ErlNifEnv *env, void *arg) destruct_esqlite_statement(ErlNifEnv *env, void *arg)
{ {
esqlite_statement *stmt = (esqlite_statement *) arg; esqlite_statement *stmt = (esqlite_statement *) arg;
sqlite3_finalize(stmt->statement);
if(stmt->statement) { stmt->statement = NULL;
sqlite3_finalize(stmt->statement);
stmt->statement = NULL;
}
} }
static ERL_NIF_TERM static ERL_NIF_TERM