aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/database.c6
-rw-r--r--src/storage.c13
2 files changed, 19 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index ea3a6e0..5595240 100644
--- a/src/database.c
+++ b/src/database.c
@@ -222,3 +222,9 @@ void debugDatabase(database *db){
}
printf("\n");
}
+
+void reOrderDatabase(database *db){
+
+
+
+}
diff --git a/src/storage.c b/src/storage.c
index 4ebbfdc..2be4d9e 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -142,6 +142,7 @@ int htableAdd(htable *ht, uint64_t h){
return 0;
}
+// We assume the table isnt ordered as of right now
uint64_t htableSearch(htable *ht, uint64_t h){
for(uint64_t i = 0; i < ht->size; ++i){
if(h == ht->table[i]){
@@ -151,6 +152,18 @@ uint64_t htableSearch(htable *ht, uint64_t h){
return -1;
}
+int htableDelete(htable *ht, uint64_t h){
+ uint64_t i = htableSearch(ht, h);
+ if(i == -1){
+ return -1;
+ }
+ ht->size--;
+ for(uint64_t j = i; j < ht->size-1; ++j){
+ ht->table[j] = ht->table[j+1];
+ }
+ return 0;
+}
+
mtable *newMtable(uint64_t size){
mtable *mt = malloc(sizeof(mtable));
size = (((uint64_t)size) < 0) ? 0 : size;