0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.1593: MS-Windows: assert error when compiled with debug mode

Problem:    MS-Windows: assert error when compiled with debug mode.
Solution:   Adjust arguments to setvbuf(). (Ken Takata, closes #12467)
This commit is contained in:
K.Takata
2023-05-31 12:47:45 +01:00
committed by Bram Moolenaar
parent 29b4c513b1
commit 3c240f608c
4 changed files with 30 additions and 3 deletions

View File

@@ -580,6 +580,7 @@ free_all_mem(void)
# ifdef FEAT_EVAL # ifdef FEAT_EVAL
free_resub_eval_result(); free_resub_eval_result();
# endif # endif
free_vbuf();
} }
#endif #endif

View File

@@ -76,6 +76,10 @@ static char *(main_errors[]) =
// Various parameters passed between main() and other functions. // Various parameters passed between main() and other functions.
static mparm_T params; static mparm_T params;
#ifdef _IOLBF
static void *s_vbuf = NULL; // buffer for setvbuf()
#endif
#ifndef NO_VIM_MAIN // skip this for unittests #ifndef NO_VIM_MAIN // skip this for unittests
static char_u *start_dir = NULL; // current working dir on startup static char_u *start_dir = NULL; // current working dir on startup
@@ -353,10 +357,14 @@ main
check_tty(&params); check_tty(&params);
#ifdef _IOLBF #ifdef _IOLBF
if (silent_mode)
{
// Ensure output works usefully without a tty: buffer lines instead of // Ensure output works usefully without a tty: buffer lines instead of
// fully buffered. // fully buffered.
if (silent_mode) s_vbuf = malloc(BUFSIZ);
setvbuf(stdout, NULL, _IOLBF, 0); if (s_vbuf != NULL)
setvbuf(stdout, s_vbuf, _IOLBF, BUFSIZ);
}
#endif #endif
// This message comes before term inits, but after setting "silent_mode" // This message comes before term inits, but after setting "silent_mode"
@@ -1027,6 +1035,21 @@ is_not_a_term_or_gui(void)
; ;
} }
#if defined(EXITFREE) || defined(PROTO)
void
free_vbuf(void)
{
# ifdef _IOLBF
if (s_vbuf != NULL)
{
setvbuf(stdout, NULL, _IONBF, 0);
free(s_vbuf);
s_vbuf = NULL;
}
# endif
}
#endif
#if defined(FEAT_GUI) || defined(PROTO) #if defined(FEAT_GUI) || defined(PROTO)
/* /*
* If a --gui-dialog-file argument was given return the file name. * If a --gui-dialog-file argument was given return the file name.

View File

@@ -3,6 +3,7 @@ int vim_main2(void);
void common_init(mparm_T *paramp); void common_init(mparm_T *paramp);
int is_not_a_term(void); int is_not_a_term(void);
int is_not_a_term_or_gui(void); int is_not_a_term_or_gui(void);
void free_vbuf(void);
char_u *get_gui_dialog_file(void); char_u *get_gui_dialog_file(void);
int op_pending(void); int op_pending(void);
void may_trigger_safestate(int safe); void may_trigger_safestate(int safe);

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1593,
/**/ /**/
1592, 1592,
/**/ /**/