This is the mail archive of the cygwin-patches mailing list for the Cygwin 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]

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


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.


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