From 155e0d26664eb90d9c03d13e0cc2ca3644177026 Mon Sep 17 00:00:00 2001 From: night0721 Date: Sun, 17 Nov 2024 19:45:32 +0000 Subject: [PATCH] More efficient code --- ccc.c | 3 +-- file.c | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/ccc.c b/ccc.c index 553fc5e..62e3020 100644 --- a/ccc.c +++ b/ccc.c @@ -1199,10 +1199,9 @@ void delete_files(void) snprintf(new_path, PATH_MAX, "%s/%s", trash_dir, marked->items[i].name); if (rename(marked->items[i].path, new_path)) { wpprintw("delete failed: %s", strerror(errno)); - } else { - change_dir(cwd, 0, 0); } } + change_dir(cwd, 0, 0); for (int i = 0; i < marked->length; i++) { arraylist_remove(marked, 0); } diff --git a/file.c b/file.c index 35bb0eb..ee8c5e0 100644 --- a/file.c +++ b/file.c @@ -117,16 +117,13 @@ char *get_line(ArrayList *list, long index, int detail, int icons) } char *line = memalloc(length); - line[0] = '\0'; if (detail) { strcat(line, file.stats); strcat(line, " "); } if (icons) { - char *tmp = memalloc(10); - snprintf(tmp, 10, "%s ", file.icon); - strcat(line, tmp); - free(tmp); + strcat(line, file.icon); + strcat(line, " "); } strcat(line, file.name);