perf(lib): check if database is full before adding new record

This commit is contained in:
2022-12-27 22:56:19 +03:00
parent af1dcb2bf2
commit 54e598fd6d
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -4,6 +4,9 @@
#include "../include/tanabata.h"
int tanabata_sasa_add(Tanabata *tanabata, const char *path) {
if (tanabata->sasahyou.size == -1 && tanabata->sasahyou.hole_cnt == 0) {
return 1;
}
Sasa *current_sasa = tanabata->sasahyou.database;
for (uint64_t i = 0; i < tanabata->sasahyou.size; i++) {
if (current_sasa->id != HOLE_ID && strcmp(current_sasa->path, path) == 0) {