chore: integrate cppcheck into workflow
This commit is contained in:
parent
b053aa6c93
commit
6af3e6ad6d
17 changed files with 64 additions and 69 deletions
|
|
@ -30,7 +30,7 @@ lsm_error lsm_store_init(lsm_store **ptr) {
|
|||
return lsm_error_ok;
|
||||
}
|
||||
|
||||
uint64_t lsm_store_size(lsm_store *store) { return lsm_trie_size(store->trie); }
|
||||
uint64_t lsm_store_size(const lsm_store *store) { return lsm_trie_size(store->trie); }
|
||||
|
||||
lsm_error lsm_store_open_read(lsm_entry_handle **out, lsm_store *store,
|
||||
lsm_str *key) {
|
||||
|
|
@ -43,11 +43,9 @@ lsm_error lsm_store_open_read(lsm_entry_handle **out, lsm_store *store,
|
|||
return lsm_error_lock_busy;
|
||||
}
|
||||
|
||||
lsm_entry *entry = wrapper->entry;
|
||||
|
||||
// While the trie's data field will never be NULL, the actual entry pointer
|
||||
// might be
|
||||
if (entry == NULL) {
|
||||
if (wrapper->entry == NULL) {
|
||||
pthread_rwlock_unlock(&wrapper->lock);
|
||||
|
||||
return lsm_error_not_found;
|
||||
|
|
@ -81,11 +79,9 @@ lsm_error lsm_store_open_write(lsm_entry_handle **out, lsm_store *store,
|
|||
return lsm_error_lock_busy;
|
||||
}
|
||||
|
||||
lsm_entry *entry = wrapper->entry;
|
||||
|
||||
// While the trie's data field will never be NULL, the actual entry pointer
|
||||
// might be
|
||||
if (entry == NULL) {
|
||||
if (wrapper->entry == NULL) {
|
||||
pthread_rwlock_unlock(&wrapper->lock);
|
||||
|
||||
return lsm_error_not_found;
|
||||
|
|
@ -202,7 +198,7 @@ lsm_error lsm_entry_data_append(lsm_entry_handle *handle, lsm_str *data) {
|
|||
|
||||
lsm_error lsm_entry_data_read(uint64_t *out, char *buf,
|
||||
lsm_entry_handle *handle, uint64_t len) {
|
||||
lsm_entry *entry = handle->wrapper->entry;
|
||||
const lsm_entry *entry = handle->wrapper->entry;
|
||||
|
||||
if (entry->data_len == 0) {
|
||||
*out = 0;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ lsm_error lsm_store_load(lsm_store **ptr, lsm_str *data_path) {
|
|||
|
||||
fclose(db_file);
|
||||
|
||||
FILE *db_file = fopen(db_file_path, "r+b");
|
||||
db_file = fopen(db_file_path, "r+b");
|
||||
|
||||
if (db_file == NULL) {
|
||||
return lsm_error_failed_io;
|
||||
|
|
@ -62,7 +62,7 @@ lsm_error lsm_store_load(lsm_store **ptr, lsm_str *data_path) {
|
|||
fclose(idx_file);
|
||||
|
||||
// If opening it in extended read mode still fails now, there's a problem
|
||||
FILE *idx_file = fopen(idx_file_path, "r+b");
|
||||
idx_file = fopen(idx_file_path, "r+b");
|
||||
|
||||
if (idx_file == NULL) {
|
||||
return lsm_error_failed_io;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ lsm_error lsm_entry_attr_get_uint64_t(uint64_t *out, lsm_entry_handle *handle,
|
|||
|
||||
LSM_RES(lsm_entry_attr_get(&s, handle, type));
|
||||
|
||||
uint64_t num;
|
||||
uint64_t num = 0;
|
||||
|
||||
for (uint8_t i = 0; i < sizeof(uint64_t) / sizeof(char); i++) {
|
||||
((char *)&num)[i] = lsm_str_char(s, i);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue