simon-git: putty (master): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Thu Feb 28 20:16:25 GMT 2019


TL;DR:
  4ecc3f3c Fix a couple of syntactically dangerous macros.
  59c8df41 Remove duplicate coroutine macros.
  a432943d Remove reallocation loop in Windows get_hostname.
  5e9213ca Move the Minefield function prototypes into puttymem.h.
  e0a76971 New array-growing macros: sgrowarray and sgrowarrayn.

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:           2019-02-28 20:16:25

commit 4ecc3f3c09677c6d932c43ad801c2a03d70f7f65
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4ecc3f3c09677c6d932c43ad801c2a03d70f7f65;hp=3e881a4248e241155710a4f978f8e7a0f39df44d
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Feb 28 18:00:31 2019 +0000

    Fix a couple of syntactically dangerous macros.
    
    The live versions of the dmemdump macros had a trailing semicolon in
    the expansion, which would cause them to break if used in the wrong
    syntactic context (e.g. between if and else with the natural semicolon
    at the call site). The conditioned-out versions of those and of
    debug() itself expanded to the empty string in place of the more usual
    ((void)0). And SECOND_PASS_ONLY in gtkmain.c's command-line handling
    should have had the standard do ... while(0) wrapper to make it
    reliably a single statement.

 misc.h         | 10 +++++-----
 unix/gtkmain.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

commit 59c8df413088a1f3a04f3b1a0487b908c44540bd
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=59c8df413088a1f3a04f3b1a0487b908c44540bd;hp=4ecc3f3c09677c6d932c43ad801c2a03d70f7f65
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Feb 28 18:05:38 2019 +0000

    Remove duplicate coroutine macros.
    
    pageant.c and sshshare.c each had an extra copy of crBegin and
    crFinishV, dating from when the main versions were kept in ssh.c where
    they couldn't be conveniently #included by other modules. Now they're
    in sshcr.h, where they can be, so there's no need to have extra copies
    of them anywhere.
    
    (But I've left the crGetChar macro in each of those files, because
    those really are specific to the particular context, referring to an
    extra variable that clients of the more general sshcr.h macros won't
    all have.)

 pageant.c  | 6 +++---
 sshshare.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

commit a432943d191a9e5b2ae7c96e49261a411db978e5
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=a432943d191a9e5b2ae7c96e49261a411db978e5;hp=59c8df413088a1f3a04f3b1a0487b908c44540bd
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Feb 28 19:58:24 2019 +0000

    Remove reallocation loop in Windows get_hostname.
    
    I've just noticed that the MSDN docs for WinSock gethostname()
    guarantee that a size-256 buffer is large enough. That seems a lot
    simpler than the previous faff.

 windows/winnet.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

commit 5e9213ca489085b58b7ce3fdb8d96962874777e9
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=5e9213ca489085b58b7ce3fdb8d96962874777e9;hp=a432943d191a9e5b2ae7c96e49261a411db978e5
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Feb 28 18:50:13 2019 +0000

    Move the Minefield function prototypes into puttymem.h.
    
    I haven't tried compiling with /DMINEFIELD in a while, and when I just
    did, I found that the declarations in winstuff.h weren't actually
    being included by memory.c where they're needed.

 puttymem.h         | 11 +++++++++++
 windows/winstuff.h | 11 -----------
 2 files changed, 11 insertions(+), 11 deletions(-)

commit e0a76971ccfac1393033b28eba9a4e5a08d4ae78
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=e0a76971ccfac1393033b28eba9a4e5a08d4ae78;hp=5e9213ca489085b58b7ce3fdb8d96962874777e9
Author: Simon Tatham <anakin at pobox.com>
Date:   Thu Feb 28 20:07:30 2019 +0000

    New array-growing macros: sgrowarray and sgrowarrayn.
    
    The idea of these is that they centralise the common idiom along the
    lines of
    
       if (logical_array_len >= physical_array_size) {
           physical_array_size = logical_array_len * 5 / 4 + 256;
           array = sresize(array, physical_array_size, ElementType);
       }
    
    which happens at a zillion call sites throughout this code base, with
    different random choices of the geometric factor and additive
    constant, sometimes forgetting them completely, and generally doing a
    lot of repeated work.
    
    The new macro sgrowarray(array,size,n) has the semantics: here are the
    array pointer and its physical size for you to modify, now please
    ensure that the nth element exists, so I can write into it. And
    sgrowarrayn(array,size,n,m) is the same except that it ensures that
    the array has size at least n+m (so sgrowarray is just the special
    case where m=1).
    
    Now that this is a single centralised implementation that will be used
    everywhere, I've also gone to more effort in the implementation, with
    careful overflow checks that would have been painful to put at all the
    previous call sites.
    
    This commit also switches over every use of sresize(), apart from a
    few where I really didn't think it would gain anything. A consequence
    of that is that a lot of array-size variables have to have their types
    changed to size_t, because the macros require that (they address-take
    the size to pass to the underlying function).

 cmdline.c           |  8 ++----
 dialog.c            | 22 ++++------------
 dialog.h            | 12 ++++-----
 ldisc.c             |  5 +---
 ldisc.h             |  2 +-
 memory.c            | 43 ++++++++++++++++++++++++++++++
 misc.c              |  7 +++--
 misc.h              |  2 +-
 pscp.c              | 14 +++-------
 psftp.c             | 43 +++++++++++-------------------
 putty.h             |  1 +
 puttymem.h          | 41 +++++++++++++++++++++++++++++
 sftp.h              |  3 +--
 sftpcommon.c        | 10 ++-----
 ssh.c               |  9 ++-----
 ssh.h               |  8 +++---
 sshcommon.c         | 11 ++------
 terminal.c          | 42 ++++++++++++------------------
 terminal.h          |  2 +-
 testcrypt.c         |  5 +---
 unix/gtkdlg.c       | 13 +++-------
 unix/gtkmain.c      |  2 +-
 unix/uxnet.c        | 10 +++----
 unix/uxpgnt.c       |  8 +++---
 unix/uxplink.c      |  8 +++---
 unix/uxserver.c     | 15 ++++-------
 unix/uxsftp.c       | 21 ++++++---------
 unix/uxsftpserver.c | 10 +++----
 unix/x11misc.c      | 12 +++------
 utils.c             | 75 +++++++++++++++++++++--------------------------------
 windows/window.c    | 16 ++++--------
 windows/winhandl.c  |  8 +++---
 windows/winmisc.c   | 10 +++----
 windows/winplink.c  |  7 ++---
 windows/winsftp.c   |  2 +-
 windows/winstore.c  |  3 +--
 windows/winutils.c  |  5 ++--
 37 files changed, 236 insertions(+), 279 deletions(-)



More information about the tartarus-commits mailing list