Fix for font caching bug (table grow bug really), attepted fix for log change event loop
parent
71334b265d
commit
e9249a382a
|
@ -1,6 +1,6 @@
|
||||||
#define MAJOR 4
|
#define MAJOR 4
|
||||||
#define MINOR 0
|
#define MINOR 0
|
||||||
#define PATCH 22
|
#define PATCH 23
|
||||||
|
|
||||||
// string
|
// string
|
||||||
#define VN__(a,b,c) #a "." #b "." #c
|
#define VN__(a,b,c) #a "." #b "." #c
|
||||||
|
|
|
@ -203,8 +203,11 @@ font_get_or_make_page(System_Functions *system, Render_Font *font, u32 page_numb
|
||||||
if (pages != 0){
|
if (pages != 0){
|
||||||
memset(pages, 0, sizeof(*pages)*new_max);
|
memset(pages, 0, sizeof(*pages)*new_max);
|
||||||
u32 old_max = font->page_max;
|
u32 old_max = font->page_max;
|
||||||
|
Glyph_Page **old_pages = font->pages;
|
||||||
|
font->pages = pages;
|
||||||
|
font->page_max = new_max;
|
||||||
for (u32 i = 0; i < old_max; ++i){
|
for (u32 i = 0; i < old_max; ++i){
|
||||||
Glyph_Page *this_page = pages[i];
|
Glyph_Page *this_page = old_pages[i];
|
||||||
if (this_page != FONT_PAGE_EMPTY && this_page != FONT_PAGE_DELETED){
|
if (this_page != FONT_PAGE_EMPTY && this_page != FONT_PAGE_DELETED){
|
||||||
u32 this_page_number = this_page->page_number;
|
u32 this_page_number = this_page->page_number;
|
||||||
Glyph_Page **dest = font_page_lookup(font, this_page_number, true);
|
Glyph_Page **dest = font_page_lookup(font, this_page_number, true);
|
||||||
|
@ -212,9 +215,7 @@ font_get_or_make_page(System_Functions *system, Render_Font *font, u32 page_numb
|
||||||
*dest = this_page;
|
*dest = this_page;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
system->font.free(font->pages);
|
system->font.free(old_pages);
|
||||||
font->pages = pages;
|
|
||||||
font->page_max = new_max;
|
|
||||||
has_space = true;
|
has_space = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
#if defined(IS_PLAT_LAYER)
|
#if defined(IS_PLAT_LAYER)
|
||||||
|
|
||||||
# if defined(USE_LOG)
|
# if defined(USE_LOG)
|
||||||
# define LOG(m) GEN_LOG(sysfunc.log, m)
|
# define LOG(m) GEN_LOG(sysfunc.log, FNLN m)
|
||||||
# else
|
# else
|
||||||
# define LOG(m)
|
# define LOG(m)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(USE_LOGF)
|
# if defined(USE_LOGF)
|
||||||
# define LOGF(...) GEN_LOGF(sysfunc.log, __VA_ARGS__)
|
# define LOGF(...) GEN_LOGF(sysfunc.log, FNLN __VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define LOGF(...)
|
# define LOGF(...)
|
||||||
# endif
|
# endif
|
||||||
|
@ -32,13 +32,13 @@
|
||||||
#else /* Not platform layer */
|
#else /* Not platform layer */
|
||||||
|
|
||||||
# if defined(USE_LOG)
|
# if defined(USE_LOG)
|
||||||
# define LOG(s,m) GEN_LOG((s)->log, m)
|
# define LOG(s,m) GEN_LOG((s)->log, FNLN m)
|
||||||
# else
|
# else
|
||||||
# define LOG(s,m)
|
# define LOG(s,m)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(USE_LOGF)
|
# if defined(USE_LOGF)
|
||||||
# define LOGF(s,...) GEN_LOGF((s)->log, __VA_ARGS__)
|
# define LOGF(s,...) GEN_LOGF((s)->log, FNLN __VA_ARGS__)
|
||||||
# else
|
# else
|
||||||
# define LOGF(s,...)
|
# define LOGF(s,...)
|
||||||
# endif
|
# endif
|
||||||
|
|
|
@ -214,43 +214,39 @@ get_change_event(File_Track_System *system, Partition *scratch, u8 *buffer, int3
|
||||||
size_t read_count = sizeof(*ev);
|
size_t read_count = sizeof(*ev);
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
|
|
||||||
do {
|
do{
|
||||||
n = read(vars->inotify, buff, read_count);
|
n = read(vars->inotify, buff, read_count);
|
||||||
read_count++;
|
read_count++;
|
||||||
} while(n == -1 && errno == EINVAL);
|
}while(n == -1 && errno == EINVAL);
|
||||||
|
|
||||||
if(n == -1 && errno != EAGAIN){
|
if (n == -1 && errno != EAGAIN){
|
||||||
perror("inotify read");
|
perror("inotify read");
|
||||||
} else if(n > 0){
|
}
|
||||||
|
else if (n > 0){
|
||||||
ev = (struct inotify_event*) buff;
|
ev = (struct inotify_event*) buff;
|
||||||
|
|
||||||
File_Index key = { ev->wd, 1 };
|
File_Index key = { ev->wd, 1 };
|
||||||
File_Track_Entry *entry = tracking_system_lookup_entry(tables, key);
|
File_Track_Entry *entry = tracking_system_lookup_entry(tables, key);
|
||||||
Linux_File_Track_Entry *linux_entry = (Linux_File_Track_Entry*) entry;
|
Linux_File_Track_Entry *linux_entry = (Linux_File_Track_Entry*) entry;
|
||||||
|
|
||||||
LINUX_FN_DEBUG("mask: %#x", ev->mask);
|
if (!entry_is_available(entry)){
|
||||||
|
|
||||||
if(!entry_is_available(entry)){
|
|
||||||
|
|
||||||
char* full_name = (char*) alloca(strlen(linux_entry->dir) + ev->len + 1);
|
char* full_name = (char*) alloca(strlen(linux_entry->dir) + ev->len + 1);
|
||||||
strcpy(full_name, linux_entry->dir);
|
strcpy(full_name, linux_entry->dir);
|
||||||
strcat(full_name, "/");
|
strcat(full_name, "/");
|
||||||
strcat(full_name, ev->name);
|
strcat(full_name, ev->name);
|
||||||
|
|
||||||
LINUX_FN_DEBUG("event from wd %d (%s)", ev->wd, full_name);
|
|
||||||
|
|
||||||
size_t full_name_size = strlen(full_name);
|
size_t full_name_size = strlen(full_name);
|
||||||
if(max < full_name_size){
|
if (max < full_name_size){
|
||||||
result = FileTrack_MemoryTooSmall;
|
result = FileTrack_MemoryTooSmall;
|
||||||
// NOTE(inso): this event will be dropped, needs to be stashed.
|
// NOTE(inso): this event will be dropped, needs to be stashed.
|
||||||
LINUX_FN_DEBUG("max too small, event dropped");
|
}
|
||||||
} else {
|
else{
|
||||||
memcpy(buffer, full_name, full_name_size);
|
memcpy(buffer, full_name, full_name_size);
|
||||||
*size = full_name_size;
|
*size = full_name_size;
|
||||||
result = FileTrack_Good;
|
result = FileTrack_Good;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LINUX_FN_DEBUG("dead event from wd %d", ev->wd);
|
//LINUX_FN_DEBUG("dead event from wd %d", ev->wd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue