More efficient code

This commit is contained in:
Night Kaly 2024-11-17 19:45:32 +00:00
parent 5d45c58ced
commit 155e0d2666
Signed by: night0721
SSH key fingerprint: SHA256:B/hgVwUoBpx5vdNsXl9w8XwZljA9766uk6T4ubZp5HM
2 changed files with 3 additions and 7 deletions

5
ccc.c
View file

@ -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);
}
}
for (int i = 0; i < marked->length; i++) {
arraylist_remove(marked, 0);
}

7
file.c
View file

@ -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);