simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Sun Feb 2 10:02:25 GMT 2020


TL;DR:
  46fc31c0 Move default_protocol and default_port into settings.c.
  6f0adb24 Change PSCP's default protocol to SSH.
  3cb86d9f Move the restricted_acl flag into winsecur.c.
  866f8e2d Move the global 'logbox' into windlg.c.
  ad0c7c99 Stop having a global Conf.
  46f60bb5 Stop winutils.c from depending on the global HWND.
  6e41db26 Windows Pageant: stop using the global 'hwnd'.
  3bbbdaad GUI PuTTY: stop using the global 'hwnd'.
  25f7f8c0 Stop using GLOBAL Windows API function pointers.
  0709de08 Remove remaining uses of the GLOBAL macro.
  9729aabd Remove the GLOBAL macro itself.
  fb5da46c Make more file-scope variables static.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: master
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2020-02-02 10:02:25

commit 46fc31c062b91858e1fa78727dd44a292ae50976
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=46fc31c062b91858e1fa78727dd44a292ae50976;hp=e9c3f1ca6d99256c4ef61bc58ab8135e9f21a9ce
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:42 2020 +0000

    Move default_protocol and default_port into settings.c.
    
    These global variables are only ever used by load_settings, which uses
    them to vary the default protocol and port number in the absence of
    any specification elsewhere. So there's no real need for them to be
    universally accessible via the awkward GLOBAL mechanism: they can be
    statics inside settings.c, with accessor functions that can set them.
    
    That was the last GLOBAL in putty.h, so I've removed the definition of
    the macro GLOBAL itself as well. There are still some GLOBALs in the
    Windows subdirectory, though.

 cmdline.c          | 40 +++++++++++++++++++++-------------------
 pscp.c             |  2 +-
 putty.h            | 23 ++---------------------
 settings.c         |  4 ++++
 unix/uxplink.c     | 16 ++++++++--------
 unix/uxpterm.c     |  2 +-
 unix/uxputty.c     |  8 ++++----
 windows/window.c   |  8 ++++----
 windows/winplink.c | 16 ++++++++--------
 9 files changed, 53 insertions(+), 66 deletions(-)

commit 6f0adb243a2bd30b1f8d608d6bc00b94c3f33f3d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=6f0adb243a2bd30b1f8d608d6bc00b94c3f33f3d;hp=46fc31c062b91858e1fa78727dd44a292ae50976
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:42 2020 +0000

    Change PSCP's default protocol to SSH.
    
    Apparently it's been set on Telnet for the entire lifetime of PSCP. It
    can't have caused any trouble, or we'd have noticed by now, but it
    still seems silly to set it to something that PSCP clearly can't
    handle!

 pscp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 3cb86d9fa8471fc279dbd8c80b3b2ca732ee89d5
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=3cb86d9fa8471fc279dbd8c80b3b2ca732ee89d5;hp=6f0adb243a2bd30b1f8d608d6bc00b94c3f33f3d
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:42 2020 +0000

    Move the restricted_acl flag into winsecur.c.
    
    It's silly to set it at each call site of restrict_process_acl() if
    that function returns success! More sensible to have it be a flag in
    the same source file as restrict_process_acl(), set as an automatic
    _side effect_ of success.
    
    I've renamed the variable itself, and the global name 'restricted_acl'
    is now a query function that asks winsecur.c whether that operation
    has been (successfully) performed.

 cmdline.c          | 1 -
 windows/window.c   | 5 ++---
 windows/winplink.c | 2 +-
 windows/winsecur.c | 5 ++++-
 windows/winsftp.c  | 2 +-
 windows/winstuff.h | 2 +-
 6 files changed, 9 insertions(+), 8 deletions(-)

commit 866f8e2d96743b5a5fc57af64295e53c8a1e59e6
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=866f8e2d96743b5a5fc57af64295e53c8a1e59e6;hp=3cb86d9fa8471fc279dbd8c80b3b2ca732ee89d5
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:42 2020 +0000

    Move the global 'logbox' into windlg.c.
    
    It was only used in one place outside that module, so I've provided an
    accessor for that one case.

 windows/windlg.c   | 3 +++
 windows/window.c   | 1 +
 windows/winstuff.h | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

commit ad0c7c99f8dd78cdf8485d508c806aece2739c9a
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=ad0c7c99f8dd78cdf8485d508c806aece2739c9a;hp=866f8e2d96743b5a5fc57af64295e53c8a1e59e6
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:42 2020 +0000

    Stop having a global Conf.
    
    It's now a static in the main source file of each application that
    uses it, and isn't accessible from any other source file unless the
    main one passes it by reference.
    
    In fact, there were almost no instances of the latter: only the
    config-box functions in windlg.c were using 'conf' by virtue of its
    globalness, and it's easy to make those take it as a parameter.

 pscp.c             |  2 +-
 psftp.c            |  2 +-
 unix/uxplink.c     |  2 +-
 windows/windlg.c   |  4 ++--
 windows/window.c   | 12 +++++++-----
 windows/winplink.c |  2 +-
 windows/winstuff.h |  5 ++---
 7 files changed, 15 insertions(+), 14 deletions(-)

commit 46f60bb547adfee6c62945b054709d15ea220e5d
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=46f60bb547adfee6c62945b054709d15ea220e5d;hp=ad0c7c99f8dd78cdf8485d508c806aece2739c9a
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:42 2020 +0000

    Stop winutils.c from depending on the global HWND.
    
    The GUI version of pgp_fingerprints() is now a differently named
    function that takes a parent HWND as a parameter, and so does my
    help-enabled wrapper around MessageBox.

 windows/windlg.c   |  4 ++--
 windows/window.c   |  4 ++--
 windows/winpgen.c  |  6 +++---
 windows/winpgnt.c  |  4 ++--
 windows/winstuff.h |  4 +++-
 windows/winutils.c | 39 ++++++++++++++++++++++-----------------
 6 files changed, 34 insertions(+), 27 deletions(-)

commit 6e41db26764f93a49cb8299fa2cef985d6f3b279
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=6e41db26764f93a49cb8299fa2cef985d6f3b279;hp=46f60bb547adfee6c62945b054709d15ea220e5d
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:43 2020 +0000

    Windows Pageant: stop using the global 'hwnd'.
    
    Windows Pageant doesn't really have a 'main window' any more, ever
    since I separated the roles of system-tray management and IPC receiver
    into two different hidden windows managed by different threads. So it
    was already silly to be storing one of them in the global 'HWND hwnd'
    variable, because it's no longer obvious which it should be.
    
    So there's now a static variable 'traywindow' within winpgnt.c which
    it uses in place of the global 'hwnd'.

 windows/winpgnt.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

commit 3bbbdaad605151aeee29d32947269f3c3b9a0445
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=3bbbdaad605151aeee29d32947269f3c3b9a0445;hp=6e41db26764f93a49cb8299fa2cef985d6f3b279
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:43 2020 +0000

    GUI PuTTY: stop using the global 'hwnd'.
    
    This was the difficult part of cleaning up that global variable. The
    main Windows PuTTY GUI is split between source files, so that _does_
    actually need to refer to the main window from multiple places.
    
    But all the places where windlg.c needed to use 'hwnd' are seat
    methods, so they were already receiving a Seat pointer as a parameter.
    In other words, the methods of the Windows GUI Seat were already split
    between source files. So it seems only fair that they should be able
    to share knowledge of the seat's data as well.
    
    Hence, I've created a small 'WinGuiSeat' structure which both window.c
    and windlg.c can see the layout of, and put the main terminal window
    handle in there. Then the seat methods implemented in windlg.c, like
    win_seat_verify_ssh_host_key, can use container_of to turn the Seat
    pointer parameter back into the address of that structure, just as the
    methods in window.c can do (even though they currently don't need to).
    
    (Who knows: now that it _exists_, perhaps that structure can be
    gradually expanded in future to turn it into a proper encapsulation of
    all the Windows frontend's state, like we should have had all
    along...)
    
    I've also moved the Windows GUI LogPolicy implementation into the same
    object (i.e. WinGuiSeat implements both traits at once). That allows
    win_gui_logging_error to recover the same WinGuiSeat from its input
    LogPolicy pointer, which means it can get from there to the Seat facet
    of the same object, so that I don't need the extern variable
    'win_seat' any more either.

 windows/windlg.c   |  16 ++--
 windows/window.c   | 240 ++++++++++++++++++++++++++---------------------------
 windows/winseat.h  |  14 ++++
 windows/winstuff.h |   6 --
 4 files changed, 143 insertions(+), 133 deletions(-)

commit 25f7f8c0257b6c16cb8558a5f643217331105593
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=25f7f8c0257b6c16cb8558a5f643217331105593;hp=3bbbdaad605151aeee29d32947269f3c3b9a0445
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:43 2020 +0000

    Stop using GLOBAL Windows API function pointers.
    
    The declarations in header files now use ordinary 'extern'. That means
    I have to arrange to put definitions matching those declarations in
    the appropriate modules; so I've made a macro DEFINE_WINDOWS_FUNCTION
    which performs a definition matching a prior DECLARE_WINDOWS_FUNCTION
    (and reusing the typedef made by the latter).
    
    This applies not only to the batch of functions that were marked
    GLOBAL in winstuff.h, but also the auxiliary sets marked
    WINCAPI_GLOBAL and WINSECUR_GLOBAL in wincapi.h and winsecur.h
    respectively.

 windows/wincapi.c  |  3 ++-
 windows/wincapi.h  |  7 +------
 windows/winnet.c   | 11 +++++------
 windows/winsecur.c |  8 +++++++-
 windows/winsecur.h | 18 +++++++-----------
 windows/winstuff.h | 13 ++++++++-----
 6 files changed, 30 insertions(+), 30 deletions(-)

commit 0709de08f2d4d387e16964b1075914a952dec5d3
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=0709de08f2d4d387e16964b1075914a952dec5d3;hp=25f7f8c0257b6c16cb8558a5f643217331105593
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:43 2020 +0000

    Remove remaining uses of the GLOBAL macro.
    
    We now have no remaining things in header files that switch from being
    a declaration to a definition depending on an awkward #define at the
    point of including that header. There are still a few mutable
    variables with external linkage, but at least now each one is defined
    in a specific source file file appropriate to its purpose and context.
    
    The remaining globals as of this commit were:
    
     - 'logctx' and 'term', which never needed to be globals in the first
       place, because they were never actually shared between source
       files. Now 'term' is just a static in window.c, and 'logctx' is a
       static in each of that and winplink.c.
    
     - 'hinst', which still has external linkage, but is now defined
       separately in each source file that sets it up (i.e. those with a
       WinMain)
    
     - osMajorVersion, osMinorVersion and osPlatformId, whose definitions
       now live in winmisc.c alongside the code which sets them up.
       (Actually they were defined there all along, it turns out, but
       every toolchain I've built with has commoned them together with the
       version defined by the GLOBAL in the header.)
    
     - 'hwnd', which nothing was actually _using_ any more after previous
       commits, so all this commit had to do was delete it.

 windows/window.c   |  4 ++++
 windows/winpgen.c  |  3 ++-
 windows/winpgnt.c  |  2 ++
 windows/winplink.c |  1 +
 windows/winstuff.h | 23 +++++------------------
 5 files changed, 14 insertions(+), 19 deletions(-)

commit 9729aabd949af9b9971deb76ed67f472d67f5d92
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=9729aabd949af9b9971deb76ed67f472d67f5d92;hp=0709de08f2d4d387e16964b1075914a952dec5d3
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:43 2020 +0000

    Remove the GLOBAL macro itself.
    
    Now it's no longer used, we can get rid of it, and better still, get
    rid of every #define PUTTY_DO_GLOBALS in the many source files that
    previously had them.

 cmdgen.c           |  2 --
 fuzzterm.c         |  1 -
 pscp.c             |  1 -
 psftp.c            |  1 -
 unix/gtkdlg.c      |  4 ----
 unix/gtkwin.c      |  2 --
 unix/uxpgnt.c      |  1 -
 unix/uxplink.c     |  1 -
 unix/uxserver.c    |  1 -
 windows/window.c   |  1 -
 windows/winpgen.c  |  2 --
 windows/winpgnt.c  |  2 --
 windows/winplink.c |  1 -
 windows/winstuff.h | 13 -------------
 14 files changed, 33 deletions(-)

commit fb5da46c4826f5bfbbe158c05b88de49e1c3b930
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=fb5da46c4826f5bfbbe158c05b88de49e1c3b930;hp=9729aabd949af9b9971deb76ed67f472d67f5d92
Author: Simon Tatham <anakin at pobox.com>
Date:   Sun Feb 2 10:00:43 2020 +0000

    Make more file-scope variables static.
    
    In the previous trawl of this, I didn't bother with the statics in
    main-program modules, on the grounds that my main aim was to avoid
    'library' objects (shared between multiple programs) from polluting
    the global namespace. But I think it's worth being more strict after
    all, so this commit adds 'static' to a lot more file-scope variables
    that aren't needed outside their own module.

 cmdgen.c           |  8 ++++----
 pscp.c             |  2 +-
 psftp.c            |  4 ++--
 unix/gtkwin.c      |  2 +-
 unix/uxpgnt.c      | 18 +++++++++---------
 unix/uxplink.c     | 12 ++++++------
 windows/window.c   |  6 +++---
 windows/winplink.c | 12 ++++++------
 8 files changed, 32 insertions(+), 32 deletions(-)



More information about the tartarus-commits mailing list