To: vim_dev@googlegroups.com Subject: Patch 8.0.1680 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1680 Problem: Memory allocated by libvterm does not show up in profile. Solution: Pass allocater functions to vterm_new(). Files: src/terminal.c *** ../vim-8.0.1679/src/terminal.c 2018-04-05 21:04:09.462997599 +0200 --- src/terminal.c 2018-04-10 11:49:31.228276406 +0200 *************** *** 39,52 **** * * TODO: * - Add a way to set the 16 ANSI colors, to be used for 'termguicolors' and in ! * the GUI. * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for * redirection. Probably in call to channel_set_pipes(). * - implement term_setsize() * - Copy text in the vterm to the Vim buffer once in a while, so that * completion works. - * - Adding WinBar to terminal window doesn't display, text isn't shifted down. - * a job that uses 16 colors while Vim is using > 256. * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito * Higashi, 2017 Sep 19) * - after resizing windows overlap. (Boris Staletic, #2164) --- 39,50 ---- * * TODO: * - Add a way to set the 16 ANSI colors, to be used for 'termguicolors' and in ! * the GUI. #2747 * - Win32: Make terminal used for :!cmd in the GUI work better. Allow for * redirection. Probably in call to channel_set_pipes(). * - implement term_setsize() * - Copy text in the vterm to the Vim buffer once in a while, so that * completion works. * - in GUI vertical split causes problems. Cursor is flickering. (Hirohito * Higashi, 2017 Sep 19) * - after resizing windows overlap. (Boris Staletic, #2164) *************** *** 3330,3335 **** --- 3328,3353 ---- }; /* + * Use Vim's allocation functions for vterm so profiling works. + */ + static void * + vterm_malloc(size_t size, void *data UNUSED) + { + return alloc_clear(size); + } + + static void + vterm_memfree(void *ptr, void *data UNUSED) + { + vim_free(ptr); + } + + static VTermAllocatorFunctions vterm_allocator = { + &vterm_malloc, + &vterm_memfree + }; + + /* * Create a new vterm and initialize it. */ static void *************** *** 3340,3346 **** VTermState *state; VTermValue value; ! vterm = vterm_new(rows, cols); term->tl_vterm = vterm; screen = vterm_obtain_screen(vterm); vterm_screen_set_callbacks(screen, &screen_callbacks, term); --- 3358,3364 ---- VTermState *state; VTermValue value; ! vterm = vterm_new_with_allocator(rows, cols, &vterm_allocator, NULL); term->tl_vterm = vterm; screen = vterm_obtain_screen(vterm); vterm_screen_set_callbacks(screen, &screen_callbacks, term); *** ../vim-8.0.1679/src/version.c 2018-04-08 16:34:18.007712750 +0200 --- src/version.c 2018-04-10 11:50:55.507684564 +0200 *************** *** 764,765 **** --- 764,767 ---- { /* Add new patch number below this line */ + /**/ + 1680, /**/ -- Amazing but true: If all the salmon caught in Canada in one year were laid end to end across the Sahara Desert, the smell would be absolutely awful. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///