This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[RFT/RFA/MinGW] remove some extraneous changes in readline/terminal.c


Hello,

While looking at Pierre's patch, I noticed that _rl_get_screen_size
was doing the same thing twice, namely:

      /* For MinGW, we get the console size from the Windows API.  */
    #if defined (__MINGW32__)
      HANDLE hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
      [... etc ...]
    #endif

... immediately followed by:

    #if defined (__EMX__)
      _emx_get_screensize (&wc, &wr);
    #elif defined (__MINGW32__)
      _win_get_screensize (&wc, &wr);
    #endif

But if you look at the body of _win_get_screensize, it is actually
identical to what the first block does.

I reviewed the readline 6.2 sources, and the first hunk isn't there,
only the call to _win_get_screensize. So, I'm thinking this might be
a merge oversight, where a different version of a patch got checked
in the standard readline sources, whereas we checked in a slightly
different version in our copy.

I tested the change by rebuilding GDB, and by running GDB through
ssh, but I don't have a quick access to a DOS window to test it
in that environment. I'd appreciate a quick test there as well,
especially after having installed Pierre's patch
(http://www.sourceware.org/ml/gdb-patches/2012-10/msg00265.html).

readline/ChangeLog.gdb:

        * terminal.c: Remove duplicate includes of windows.h and
        wincon.h.
        (_rl_get_screen_size): Remove redundant code for MinGW getting
        the console size from the Windows API.

Given the small amount of testing, I won't commit unless someone
reviews this patch and agrees that it is correct.

Thank you,
-- 
Joel
diff --git a/readline/terminal.c b/readline/terminal.c
index 255b5e6..8094186 100644
--- a/readline/terminal.c
+++ b/readline/terminal.c
@@ -81,11 +81,6 @@ static void _win_get_screensize PARAMS((int *, int *));
 static void _emx_get_screensize PARAMS((int *, int *));
 #endif
 
-#if defined (__MINGW32__)
-# include <windows.h>
-# include <wincon.h>
-#endif
-
 #define CUSTOM_REDISPLAY_FUNC() (rl_redisplay_function != rl_redisplay)
 #define CUSTOM_INPUT_FUNC() (rl_getc_function != rl_getc)
 
@@ -250,20 +245,6 @@ _rl_get_screen_size (tty, ignore_env)
     }
 #endif /* TIOCGWINSZ */
 
-  /* For MinGW, we get the console size from the Windows API.  */
-#if defined (__MINGW32__)
-  HANDLE hConOut = GetStdHandle (STD_OUTPUT_HANDLE);
-  if (hConOut != INVALID_HANDLE_VALUE)
-    {
-      CONSOLE_SCREEN_BUFFER_INFO scr;
-      if (GetConsoleScreenBufferInfo (hConOut, &scr))
-	{
-	  wc = scr.dwSize.X;
-	  wr = scr.srWindow.Bottom - scr.srWindow.Top + 1;
-	}
-    }
-#endif
-
 #if defined (__EMX__)
   _emx_get_screensize (&wc, &wr);
 #elif defined (__MINGW32__)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]