diff options
| author | dam <dam@gudinoff> | 2022-11-25 00:26:33 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-11-25 00:26:33 +0000 |
| commit | 58219552753d2c4d5e8214196b918c95d48f7d5b (patch) | |
| tree | 56fb3a29049c03984fa0d178b37063655ffd3406 /main.c | |
| parent | d808a8c3af7a048d3d186cf10a8122e8d3ffc6bc (diff) | |
| download | task-time-tracker-58219552753d2c4d5e8214196b918c95d48f7d5b.tar.zst task-time-tracker-58219552753d2c4d5e8214196b918c95d48f7d5b.zip | |
Improved comments.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -54,7 +54,7 @@ typedef struct { typedef struct { task_st *tasks; size_t count; // Will always be equal or less than capacity. - size_t capacity; // Limited to PTRDIFF_MAX. + size_t capacity; // Will always be equal or less than PTRDIFF_MAX (see MAX_DATABASE_TASKS). ptrdiff_t active_task; // Will always be less than capacity/count. ptrdiff_t selected_task; // Will always be less than capacity/count. int64_t modified_on; @@ -288,8 +288,9 @@ bool create_task(database_st *db, task_st **task) { // If necessary, expand database capacity. size_t current_capacity = db->capacity; if((db->count + 1) > current_capacity) { - size_t new_capacity = current_capacity == 0 ? 2 : - current_capacity > MAX_DATABASE_TASKS >> 1 ? MAX_DATABASE_TASKS : + size_t new_capacity = + current_capacity == 0 ? 2 : + current_capacity > (MAX_DATABASE_TASKS >> 1) ? MAX_DATABASE_TASKS : current_capacity << 1; task_st *new_tasks = realloc(db->tasks, new_capacity * SIZEOF_TASK_ST); |
