More efficient code
This commit is contained in:
parent
5d45c58ced
commit
155e0d2666
2 changed files with 3 additions and 7 deletions
3
ccc.c
3
ccc.c
|
@ -1199,10 +1199,9 @@ void delete_files(void)
|
||||||
snprintf(new_path, PATH_MAX, "%s/%s", trash_dir, marked->items[i].name);
|
snprintf(new_path, PATH_MAX, "%s/%s", trash_dir, marked->items[i].name);
|
||||||
if (rename(marked->items[i].path, new_path)) {
|
if (rename(marked->items[i].path, new_path)) {
|
||||||
wpprintw("delete failed: %s", strerror(errno));
|
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++) {
|
for (int i = 0; i < marked->length; i++) {
|
||||||
arraylist_remove(marked, 0);
|
arraylist_remove(marked, 0);
|
||||||
}
|
}
|
||||||
|
|
7
file.c
7
file.c
|
@ -117,16 +117,13 @@ char *get_line(ArrayList *list, long index, int detail, int icons)
|
||||||
}
|
}
|
||||||
|
|
||||||
char *line = memalloc(length);
|
char *line = memalloc(length);
|
||||||
line[0] = '\0';
|
|
||||||
if (detail) {
|
if (detail) {
|
||||||
strcat(line, file.stats);
|
strcat(line, file.stats);
|
||||||
strcat(line, " ");
|
strcat(line, " ");
|
||||||
}
|
}
|
||||||
if (icons) {
|
if (icons) {
|
||||||
char *tmp = memalloc(10);
|
strcat(line, file.icon);
|
||||||
snprintf(tmp, 10, "%s ", file.icon);
|
strcat(line, " ");
|
||||||
strcat(line, tmp);
|
|
||||||
free(tmp);
|
|
||||||
}
|
}
|
||||||
strcat(line, file.name);
|
strcat(line, file.name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue