mirror of
https://gittea.dev/nova/th.git
synced 2025-10-22 02:40:15 -04:00
temporary fixes & removal of unused function
This commit is contained in:
19
dir.c
19
dir.c
@@ -54,7 +54,7 @@ unsigned long get_dir_size(char *path){
|
||||
}
|
||||
|
||||
void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_content){
|
||||
struct dirent **entry;
|
||||
struct dirent **entry = NULL;
|
||||
if (file_modifiers & FILE_MODIFIERS_HIDDEN_FILES) { /* print hidden files */
|
||||
scandir(path, &entry, skip_dot, NULL);
|
||||
} else {
|
||||
@@ -147,7 +147,10 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten
|
||||
for (i = 0; i < *dir_file_count; i++) {
|
||||
free(entry[i]);
|
||||
}
|
||||
free(entry);
|
||||
if (entry != NULL) {
|
||||
free(entry);
|
||||
} else {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -243,7 +246,7 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
* example input: aaaaaaaa.txt
|
||||
* example output: aaa~.txt
|
||||
* if no extension is found, the name will truncate */
|
||||
char *file_name;
|
||||
char *file_name = NULL;
|
||||
unsigned long printable_size = (offset_back - is_selected - offset_front);
|
||||
if (strlen(dir_content[i].file_name) > printable_size) {
|
||||
char *extension = strrchr(dir_content[i].file_name, '.');
|
||||
@@ -312,8 +315,14 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
||||
} else {
|
||||
mvwaddnstr(win, i-offset_vertical, 0, file_name, line_width);
|
||||
}
|
||||
free(file_name);
|
||||
|
||||
if (file_name != NULL) {
|
||||
/* sometimes NULL remains, need to do deeper analysis soon */
|
||||
free(file_name);
|
||||
} else {
|
||||
printf("file_name remains NULL on %s, if this happens consistent on the same file, please inform me", dir_content[i].file_name);
|
||||
volatile static int debug_print_dir;
|
||||
debug_print_dir++;
|
||||
}
|
||||
if (dir_content[i].status & FILE_STATUS_SELECTED) {
|
||||
wattroff(win, COLOR_PAIR(8));
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user