https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=8af023a357fba8974be89af41a6c42d09374ac46

commit 8af023a357fba8974be89af41a6c42d09374ac46
Author:     Corinna Vinschen <[email protected]>
AuthorDate: Tue Nov 15 17:43:15 2022 +0100
Commit:     Corinna Vinschen <[email protected]>
CommitDate: Sun Dec 4 14:01:41 2022 +0100

    Cygwin: drop wincap::cons_need_small_input_record_buf
    
    Only required for Windows 7.
    
    Signed-off-by: Corinna Vinschen <[email protected]>

Diff:
---
 winsup/cygwin/fhandler/console.cc     | 29 +++++++++--------------------
 winsup/cygwin/local_includes/wincap.h |  2 --
 winsup/cygwin/wincap.cc               | 12 ------------
 3 files changed, 9 insertions(+), 34 deletions(-)

diff --git a/winsup/cygwin/fhandler/console.cc 
b/winsup/cygwin/fhandler/console.cc
index a4a367005da4..bbf4b0103b95 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -302,9 +302,6 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty 
*ttyp)
       return;
     }
 
-  DWORD inrec_size1 =
-    wincap.cons_need_small_input_record_buf () ? INREC_SIZE : inrec_size;
-
   struct m
   {
     inline static size_t bytes (size_t n)
@@ -354,11 +351,7 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty 
*ttyp)
          if (new_input_tmp)
            input_tmp = new_input_tmp;
          if (new_input_rec && new_input_tmp)
-           {
-             inrec_size = new_inrec_size;
-             if (!wincap.cons_need_small_input_record_buf ())
-               inrec_size1 = inrec_size;
-           }
+           inrec_size = new_inrec_size;
        }
 
       WaitForSingleObject (p->input_mutex, mutex_timeout);
@@ -373,7 +366,7 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty 
*ttyp)
            {
              DWORD len;
              ReadConsoleInputW (p->input_handle, input_rec + total_read,
-                                min (inrec_size - total_read, inrec_size1),
+                                min (inrec_size - total_read, inrec_size),
                                 &len);
              total_read += len;
            }
@@ -471,7 +464,7 @@ remove_record:
                {
                  DWORD len;
                  WriteConsoleInputW (p->input_handle, input_rec + n,
-                                     min (total_read - n, inrec_size1), &len);
+                                     min (total_read - n, inrec_size), &len);
                  n += len;
                }
              release_attach_mutex ();
@@ -491,22 +484,18 @@ remove_record:
                  if (new_input_tmp)
                    input_tmp = new_input_tmp;
                  if (new_input_rec && new_input_tmp)
-                   {
-                     inrec_size = new_inrec_size;
-                     if (!wincap.cons_need_small_input_record_buf ())
-                       inrec_size1 = inrec_size;
-                   }
+                   inrec_size = new_inrec_size;
                }
 
              /* Check if writeback was successfull. */
              acquire_attach_mutex (mutex_timeout);
-             PeekConsoleInputW (p->input_handle, input_tmp, inrec_size1, &n);
+             PeekConsoleInputW (p->input_handle, input_tmp, inrec_size, &n);
              release_attach_mutex ();
-             if (n < min (total_read, inrec_size1))
+             if (n < min (total_read, inrec_size))
                break; /* Someone has read input without acquiring
                          input_mutex. ConEmu cygwin-connector? */
              if (inrec_eq (input_rec, input_tmp,
-                           min (total_read, inrec_size1)))
+                           min (total_read, inrec_size)))
                break; /* OK */
              /* Try to fix */
              acquire_attach_mutex (mutex_timeout);
@@ -516,7 +505,7 @@ remove_record:
                {
                  DWORD len;
                  ReadConsoleInputW (p->input_handle, input_tmp + n,
-                                    min (inrec_size - n, inrec_size1), &len);
+                                    min (inrec_size - n, inrec_size), &len);
                  n += len;
                }
              release_attach_mutex ();
@@ -549,7 +538,7 @@ remove_record:
                                DWORD len;
                                WriteConsoleInputW (p->input_handle,
                                                    input_tmp + l,
-                                                   min (n - l, inrec_size1),
+                                                   min (n - l, inrec_size),
                                                    &len);
                                l += len;
                              }
diff --git a/winsup/cygwin/local_includes/wincap.h 
b/winsup/cygwin/local_includes/wincap.h
index c26324fd6dac..96bd68a93f95 100644
--- a/winsup/cygwin/local_includes/wincap.h
+++ b/winsup/cygwin/local_includes/wincap.h
@@ -33,7 +33,6 @@ struct wincaps
     unsigned has_linux_tcp_keepalive_sockopts                  : 1;
     unsigned has_tcp_maxrtms                                   : 1;
     unsigned has_con_broken_tabs                               : 1;
-    unsigned cons_need_small_input_record_buf                  : 1;
   };
 };
 
@@ -86,7 +85,6 @@ public:
   bool IMPLEMENT (has_linux_tcp_keepalive_sockopts)
   bool IMPLEMENT (has_tcp_maxrtms)
   bool IMPLEMENT (has_con_broken_tabs)
-  bool IMPLEMENT (cons_need_small_input_record_buf)
 
   void disable_case_sensitive_dirs ()
   {
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index fe5986c76e21..f83eed8a7e1a 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -40,7 +40,6 @@ wincaps wincap_7 __attribute__((section 
(".cygwin_dll_common"), shared)) = {
     has_linux_tcp_keepalive_sockopts:false,
     has_tcp_maxrtms:false,
     has_con_broken_tabs:false,
-    cons_need_small_input_record_buf:true,
   },
 };
 
@@ -65,7 +64,6 @@ wincaps wincap_8 __attribute__((section 
(".cygwin_dll_common"), shared)) = {
     has_linux_tcp_keepalive_sockopts:false,
     has_tcp_maxrtms:false,
     has_con_broken_tabs:false,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -90,7 +88,6 @@ wincaps wincap_8_1 __attribute__((section 
(".cygwin_dll_common"), shared)) = {
     has_linux_tcp_keepalive_sockopts:false,
     has_tcp_maxrtms:false,
     has_con_broken_tabs:false,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -115,7 +112,6 @@ wincaps  wincap_10_1507 __attribute__((section 
(".cygwin_dll_common"), shared))
     has_linux_tcp_keepalive_sockopts:false,
     has_tcp_maxrtms:false,
     has_con_broken_tabs:false,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -140,7 +136,6 @@ wincaps  wincap_10_1607 __attribute__((section 
(".cygwin_dll_common"), shared))
     has_linux_tcp_keepalive_sockopts:false,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:false,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -165,7 +160,6 @@ wincaps wincap_10_1703 __attribute__((section 
(".cygwin_dll_common"), shared)) =
     has_linux_tcp_keepalive_sockopts:false,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:true,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -190,7 +184,6 @@ wincaps wincap_10_1709 __attribute__((section 
(".cygwin_dll_common"), shared)) =
     has_linux_tcp_keepalive_sockopts:true,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:true,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -215,7 +208,6 @@ wincaps wincap_10_1803 __attribute__((section 
(".cygwin_dll_common"), shared)) =
     has_linux_tcp_keepalive_sockopts:true,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:true,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -240,7 +232,6 @@ wincaps wincap_10_1809 __attribute__((section 
(".cygwin_dll_common"), shared)) =
     has_linux_tcp_keepalive_sockopts:true,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:true,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -265,7 +256,6 @@ wincaps wincap_10_1903 __attribute__((section 
(".cygwin_dll_common"), shared)) =
     has_linux_tcp_keepalive_sockopts:true,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:true,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -290,7 +280,6 @@ wincaps wincap_10_2004 __attribute__((section 
(".cygwin_dll_common"), shared)) =
     has_linux_tcp_keepalive_sockopts:true,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:true,
-    cons_need_small_input_record_buf:false,
   },
 };
 
@@ -315,7 +304,6 @@ wincaps wincap_11 __attribute__((section 
(".cygwin_dll_common"), shared)) = {
     has_linux_tcp_keepalive_sockopts:true,
     has_tcp_maxrtms:true,
     has_con_broken_tabs:false,
-    cons_need_small_input_record_buf:false,
   },
 };

Reply via email to