aboutsummaryrefslogtreecommitdiff
path: root/ttt.jai
diff options
context:
space:
mode:
authordam <dam@gudinoff>2023-07-31 09:06:54 +0100
committerdam <dam@gudinoff>2023-07-31 09:06:54 +0100
commit8df31fd16d001d2f321eba39eb52d657a57396c1 (patch)
tree03deecacce677a1854ccfb7280ebebf1fc4c9abd /ttt.jai
parent4fc88c787015268ecb658a72c17749b33200f9b9 (diff)
downloadtask-time-tracker-8df31fd16d001d2f321eba39eb52d657a57396c1.tar.zst
task-time-tracker-8df31fd16d001d2f321eba39eb52d657a57396c1.zip
WIP : Added notes to fix delete_task.
Diffstat (limited to 'ttt.jai')
-rw-r--r--ttt.jai8
1 files changed, 6 insertions, 2 deletions
diff --git a/ttt.jai b/ttt.jai
index a35ac48..b210129 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -360,11 +360,14 @@ delete_task :: (using db: *Database, index: s64) -> bool { // TODO Maybe use `us
}
// Try to shrink database capacity if using more than 2MB.
- // TODO WIP WIP WIP
+ TODO WIP WIP WIP Coalescing is failing because of this...
+ //
if (tasks.allocated >> 2) > tasks.count && tasks.allocated * SIZE_OF_TASK > 2_000_000 {
+ print("> A <");
new_capacity := tasks.allocated >> 1;
msg := tprint("shrinking from % to %\n", tasks.allocated, new_capacity);
print_error(msg);
+ // if !tasks.allocator.proc remember_allocators(*tasks);
new_tasks_data := realloc(tasks.data, new_capacity * SIZE_OF_TASK, tasks.allocated * SIZE_OF_TASK, tasks.allocator);
if new_tasks_data != null {
msg = tprint("OH NOEWS");
@@ -374,6 +377,7 @@ delete_task :: (using db: *Database, index: s64) -> bool { // TODO Maybe use `us
}
msg = tprint("ALL OK");
print_error(msg);
+ print("> B <");
}
return true;
@@ -1695,7 +1699,7 @@ main :: () {
while tasks_to_process > 0 {
task := *db.tasks[idx];
for < i : db.tasks.count-1..idx+1 {
- if compare_strings(xx task.name, xx db.tasks[i].name) == 0 {
+ if compare_strings(xx task.name, xx db.tasks[i].name) == 0 {
for item, index: db.tasks[i].times {
task.times[index] = add(task.times[index], item);
}