1
0
mirror of https://gittea.dev/nova/th.git synced 2025-10-21 10:20:15 -04:00

temporary fixes & removal of unused function

This commit is contained in:
nova
2025-10-11 21:49:28 +02:00
parent 3fa16fd8b2
commit 61023ce42e
3 changed files with 27 additions and 23 deletions

19
dir.c
View File

@@ -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 {

View File

@@ -46,7 +46,6 @@ int parsed_input_number;
yank yank_files = { 0 };
int read_string(WINDOW *win, int y, int x, char *str);
int strcmp_offset(char *in0, char *in1, char offset);
extern void render_pass();
extern int (*order_func)();
@@ -70,7 +69,7 @@ void user_interactions() {
ch = getch();
if(ch != ERR) {
timeout(1); /* blocking timeout of getch() */
timeout(10); /* blocking timeout of getch() */
input[input_pass] = ch;
mvaddstr(terminal_height-1, (terminal_width/3)*2, input);
input_pass++;
@@ -83,6 +82,8 @@ void user_interactions() {
}
binding_pass = 0;
status |= STATUS_UPDATE_SCREEN_0;
} else {
timeout(100);
}
@@ -119,7 +120,7 @@ void user_interactions() {
}
if (status & STATUS_INPUT_MATCH) {
attron(A_UNDERLINE);
mvaddstr(terminal_height-binding_matches-2, 0, "input\tcommand\t\t");
mvwprintw(stdscr, terminal_height-binding_matches-2, 0, "input\tcommand\t\t");
attroff(A_UNDERLINE);
status &= ~STATUS_INPUT_MATCH;
} else if (number_length != strlen(input)) {
@@ -172,19 +173,6 @@ int read_string(WINDOW *win, int y, int x, char *str){
return err;
}
int strcmp_offset(char *in0, char *in1, char offset){
int i = 0;
while (in0[i] != '\0' && in1[i] != '\0') {
if (in0[i+offset] != in1[i]) {
return 1;
}
i++;
in1++;
}
return 0;
}
void quit_program(){
status = STATUS_QUIT_PROGRAM;
}

View File

@@ -247,7 +247,7 @@ void *thread_top(){
pthread_exit(0);
}
void *thread_btm(){
char *path = malloc(sizeof(char));
char *path = NULL;
char *ui_btm_right_block = malloc(sizeof(char));
unsigned int ui_btm_right_block_size = 0;
unsigned int buffer_width = 0;
@@ -271,7 +271,14 @@ void *thread_btm(){
pthread_mutex_unlock(&mutex_mid);
free(path);
if (path != NULL) {
/* sometimes NULL remains, need to do deeper analysis soon */
free(path);
path = NULL;
} else {
volatile static int debug_thread_btm;
debug_thread_btm++;
}
free(ui_btm_right_block);
path = getcwd(NULL, 0);