aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/main.c b/main.c
index c1c5c76..769a966 100644
--- a/main.c
+++ b/main.c
@@ -118,7 +118,7 @@ bool is_equal_to_any(const char *to_compare, const char *test_a, const char *tes
// The string should have capacity for at least length + 1.
// The terminating null byte ('\0') is not included in length.
// Returns the truncated string length.
-size_t truncate_string_utf8(char *string, size_t length) { // TODO Rename to truncate_utf_string
+size_t truncate_string_utf8(char *string, size_t length) {
assert(string != NULL);
// TODO Review this function...
@@ -649,8 +649,8 @@ bool export_to_csv(const database_st *db, const char *path) {
);
char name[TASK_NAME_BYTES];
- task_st *limit = db->tasks + db->count;
- for (task_st *task = db->tasks; task < limit; task++) { // TODO Simplify for loop.
+ for (size_t idx = 0; idx < db->count; idx++) {
+ task_st *task = db->tasks[idx];
memcpy(name, task->name, TASK_NAME_BYTES);
replace_char(name, ',', ' ');
fprintf(file, "%s,%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 ",%" PRId64 "\n",
@@ -1193,7 +1193,7 @@ int main(int argc, char *argv[]) {
bool is_exit_requested = false;
for (unsigned idx = 1; idx < argc; idx++) {
if (is_equal_to_any(argv[idx], "--help", "-h")) {
- // TODO Maybe rearrange the order of the command.
+ // TODO Maybe rearrange the order of the command... or chose other hot-keys?
fprintf(stdout,
"Usage: ttt [OPTION]... [FILE]...\n"
" -i, --import-csv [FILE] Import CSV file to database (discard first row).\n"
@@ -1364,7 +1364,7 @@ int main(int argc, char *argv[]) {
struct tm *now_local = localtime(&now_utc);
strftime(new_task->name, TASK_NAME_BYTES, "%Y-%m-%d %H:%M:%S", now_local);
- // Select new task. TODO Maybe do this on the database?
+ // Select new task.
select_task(db, new_task);
selected_task = get_selected_task(db);
trigger_autosave();
@@ -1645,7 +1645,6 @@ int main(int argc, char *argv[]) {
case '\t': {
if (db == &database) {
- reset_database(&archive); // TODO Not needed because we never leave things hanging.
import_from_csv(&archive, ar_file_path);
db = &archive;
}