1
0
mirror of https://gittea.dev/nova/th.git synced 2026-01-30 16:50:10 -05:00

-fsanitize=address related compiler assisted debugging

This commit is contained in:
nova
2026-01-12 18:35:38 +01:00
parent 66f3f3bef6
commit 8734fa6ae4
4 changed files with 24 additions and 17 deletions

View File

@@ -165,9 +165,7 @@ void *thread_rgt(){
path = malloc(sizeof(char));
path[0] = '\0';
}
file_current.file_type = mid_content[selected_file_current].file_type;
file_current.file_size = mid_content[selected_file_current].file_size;
file_current.status = mid_content[selected_file_current].status;
memcpy(&file_current, &mid_content[selected_file_current], sizeof(file));
pthread_mutex_unlock(&mutex_mid);
if (mid_content[selected_file_current].permissions & S_IRUSR) {
@@ -185,14 +183,20 @@ void *thread_rgt(){
free(rgt_content);
rgt_file_count = get_dir_size(path);
rgt_content = malloc(rgt_file_count * sizeof(file));
memset(rgt_content, '\0', rgt_file_count * sizeof(file));
get_dir_content(path, &rgt_file_count, rgt_content);
rgt_content[0].status &= ~FILE_STATUS_FILE_OPEN;
if (rgt_file_count) { /* fails if dir empty */
rgt_content = malloc(rgt_file_count * sizeof(file));
memset(rgt_content, '\0', rgt_file_count * sizeof(file));
get_dir_content(path, &rgt_file_count, rgt_content);
rgt_content[0].status &= ~FILE_STATUS_FILE_OPEN;
free(rgt_buffer);
rgt_buffer = malloc(sizeof(char));
rgt_buffer[0] = '\0';
free(rgt_buffer);
rgt_buffer = malloc(sizeof(char));
rgt_buffer[0] = '\0';
} else { /* the hovered dir is empty */
rgt_content = malloc(sizeof(file));
rgt_content->file_type = 0;
rgt_content->permissions = mid_content[selected_file_current].permissions;
}
} else if ((status & STATUS_DELTA_TIME) != STATUS_DELTA_TIME) {
unsigned long i = 0;
@@ -282,6 +286,9 @@ void *thread_btm(){
free(ui_btm_right_block);
if(path) {
free(path);
}
path = getcwd(NULL, 0);
struct statvfs fs;
statvfs(path, &fs);
@@ -338,10 +345,9 @@ void *thread_btm(){
if (buffer_width != terminal_width) {
buffer_width = terminal_width;
free(btm_buffer);
btm_buffer = malloc(buffer_width);
memset(btm_buffer, ' ', buffer_width/2);
btm_buffer = malloc(buffer_width+1);
}
memset(btm_buffer + (buffer_width/2), ' ', buffer_width/2);
memset(btm_buffer, ' ', buffer_width);
btm_buffer[buffer_width] = '\0';
memcpy(btm_buffer + buffer_width - ui_btm_right_block_size, ui_btm_right_block, ui_btm_right_block_size);
@@ -379,13 +385,11 @@ void threading_init(){
mid_content->file_type = 0;
mid_content->file_size = 0;
mid_content->file_name = malloc(sizeof(char));
mid_content->file_name[0] = '\0';
mid_content->file_name = "";
rgt_content->file_type = 0;
rgt_content->file_size = 0;
rgt_content->file_name = malloc(sizeof(char));
rgt_content->file_name[0] = '\0';
rgt_content->file_name = "";
volatile char vol; /* needed to make sure higher optimization steps dont move these around */