[PATCH 1/1] Collect handling of wpixput and wpbuf into a helper class.

Hans-Bernhard Bröker HBBroeker@t-online.de
Tue Mar 3 20:03:00 GMT 2020


Am 03.03.2020 um 01:35 schrieb Takashi Yano:

> The second argument DWORD *wn of sendOut() is not used
> outside sendOut(), so it can be covered up like:
> 
> inline void sendOut (HANDLE &handle)
> {
>    DWORD wn;
>    WriteConsoleA (handle, buf, ixput, &wn, 0);
> }
> 

I doubt that will improve much, if anything.  There are still direct 
calls to WriteConsoleA() left, working on other buffers, and those still 
use the DWORD wn defined near the top of 
fhandler_console::char_command().  So that the existing varialbe would 
have to be kept anyway.  That means the variables local to each 
invocation (!) of wpbuf.sendOut would just clutter the stack for no gain.

OTOH the MS documentation calls this DWORD* an "optional output" 
argument.  If I'm reading that right, it means it should be fine to just 
pass NULL to indicate that we don't need it:

inline void sendOut (HANDLE &handle)
{
   WriteConsoleA (handle, buf, ixput, 0, 0);
}

The same would apply to all the other calls of WriteConsoleA, it seems.



More information about the Cygwin-patches mailing list