mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
vim-patch:9.0.1271: using sizeof() and subtract array size is tricky (#22087)
Problem: Using sizeof() and subtract array size is tricky.
Solution: Use offsetof() instead. (closes vim/vim#11926)
1b438a8228
This commit is contained in:
@@ -1092,7 +1092,7 @@ static int ff_check_visited(ff_visited_T **visited_list, char *fname, char *wc_p
|
||||
}
|
||||
|
||||
// New file/dir. Add it to the list of visited files/dirs.
|
||||
vp = xmalloc(sizeof(ff_visited_T) + strlen(ff_expand_buffer));
|
||||
vp = xmalloc(offsetof(ff_visited_T, ffv_fname) + strlen(ff_expand_buffer) + 1);
|
||||
|
||||
if (!url) {
|
||||
vp->file_id_valid = true;
|
||||
|
Reference in New Issue
Block a user