Patch 9.0.1593
Problem:    MS-Windows: assert error when compiled with debug mode.
Solution:   Adjust arguments to setvbuf(). (Ken Takata, closes #12467)
Files:      src/alloc.c, src/main.c, src/proto/main.pro


*** ../vim-9.0.1592/src/alloc.c 2023-01-06 18:42:16.430674097 +0000
--- src/alloc.c 2023-05-31 12:39:26.061199896 +0100
***************
*** 580,585 ****
--- 580,586 ----
  # ifdef FEAT_EVAL
      free_resub_eval_result();
  # endif
+     free_vbuf();
  }
  #endif
  
*** ../vim-9.0.1592/src/main.c  2023-05-20 16:39:03.337433572 +0100
--- src/main.c  2023-05-31 12:46:17.937291837 +0100
***************
*** 76,81 ****
--- 76,85 ----
  // Various parameters passed between main() and other functions.
  static mparm_T        params;
  
+ #ifdef _IOLBF
+ static void *s_vbuf = NULL;           // buffer for setvbuf()
+ #endif
+ 
  #ifndef NO_VIM_MAIN   // skip this for unittests
  
  static char_u *start_dir = NULL;      // current working dir on startup
***************
*** 353,362 ****
      check_tty(&params);
  
  #ifdef _IOLBF
-     // Ensure output works usefully without a tty: buffer lines instead of
-     // fully buffered.
      if (silent_mode)
!       setvbuf(stdout, NULL, _IOLBF, 0);
  #endif
  
      // This message comes before term inits, but after setting "silent_mode"
--- 357,370 ----
      check_tty(&params);
  
  #ifdef _IOLBF
      if (silent_mode)
!     {
!       // Ensure output works usefully without a tty: buffer lines instead of
!       // fully buffered.
!       s_vbuf = malloc(BUFSIZ);
!       if (s_vbuf != NULL)
!           setvbuf(stdout, s_vbuf, _IOLBF, BUFSIZ);
!     }
  #endif
  
      // This message comes before term inits, but after setting "silent_mode"
***************
*** 1027,1032 ****
--- 1035,1055 ----
        ;
  }
  
+ #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 a --gui-dialog-file argument was given return the file name.
*** ../vim-9.0.1592/src/proto/main.pro  2022-12-01 12:03:42.263227523 +0000
--- src/proto/main.pro  2023-05-31 12:44:48.453265128 +0100
***************
*** 3,8 ****
--- 3,9 ----
  void common_init(mparm_T *paramp);
  int is_not_a_term(void);
  int is_not_a_term_or_gui(void);
+ void free_vbuf(void);
  char_u *get_gui_dialog_file(void);
  int op_pending(void);
  void may_trigger_safestate(int safe);
*** ../vim-9.0.1592/src/version.c       2023-05-30 15:34:45.598659261 +0100
--- src/version.c       2023-05-31 12:40:50.193211143 +0100
***************
*** 697,698 ****
--- 697,700 ----
  {   /* Add new patch number below this line */
+ /**/
+     1593,
  /**/

-- 
>From "know your smileys":
 %-)    After staring at the screen for 15 hours

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20230531114816.CF4671C1B37%40moolenaar.net.

Raspunde prin e-mail lui