1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00
putty-source/unix
Simon Tatham e0a76971cc 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).
2019-02-28 20:15:38 +00:00
..
configure Move the Unix configure script up to the top level. 2014-02-22 18:01:32 +00:00
gtkapp.c Move all extern declarations into header files. 2018-11-03 13:47:29 +00:00
gtkask.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcfg.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcols.c Add some more miscellaneous asserts. 2018-12-01 17:04:44 +00:00
gtkcols.h Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcomm.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkcompat.h Adopt C99 <stdbool.h>'s true/false. 2018-11-03 13:45:00 +00:00
gtkdlg.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
gtkfont.c Add some more miscellaneous asserts. 2018-12-01 17:04:44 +00:00
gtkfont.h Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkmain.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
gtkmisc.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkmisc.h Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
gtkwin.c Make lots of 'int' length fields into size_t. 2019-02-06 21:46:10 +00:00
osxlaunch.c osxlaunch: stop setting DYLD_LIBRARY_PATH. 2017-12-20 10:04:02 +00:00
pterm.bundle OS X makefile: stop depending on JHBUILD_PREFIX. 2017-11-26 11:45:48 +00:00
pterm.plist Create OS X application bundles for PuTTY and pterm. 2016-03-23 22:22:48 +00:00
putty.bundle OS X makefile: stop depending on JHBUILD_PREFIX. 2017-11-26 11:45:48 +00:00
putty.plist Create OS X application bundles for PuTTY and pterm. 2016-03-23 22:22:48 +00:00
unix.h Move all extern declarations into header files. 2018-11-03 13:47:29 +00:00
ux_x11.c Uppity X forwarding: fix SockAddr use after free. 2019-01-23 21:19:26 +00:00
uxagentc.c Stop using unqualified {GET,PUT}_32BIT. 2019-02-04 20:32:31 +00:00
uxagentsock.c Close standard handles in watchdog subprocesses. 2018-10-21 10:16:16 +01:00
uxcfg.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxcons.c Make bufchain_prefix return a ptrlen. 2019-02-06 21:46:10 +00:00
uxfdsock.c Make bufchain_prefix return a ptrlen. 2019-02-06 21:46:10 +00:00
uxgen.c Unix PuTTYgen: switch to /dev/urandom by default. 2018-06-03 15:15:51 +01:00
uxgss.c Support GSS key exchange, for Kerberos 5 only. 2018-04-26 07:21:16 +01:00
uxmisc.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxnet.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
uxnogtk.c Include the compile-time GTK version in the build info. 2017-02-15 19:32:42 +00:00
uxnoise.c Replace PuTTY's PRNG with a Fortuna-like system. 2019-01-23 22:36:17 +00:00
uxpeer.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxpgnt.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
uxplink.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
uxprint.c Make bufchain_prefix return a ptrlen. 2019-02-06 21:46:10 +00:00
uxproxy.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxpterm.c Label random-noise sources with an enum of ids. 2019-01-23 22:36:17 +00:00
uxpty.c uxpty.c: initialise pty->pending_eof. 2019-02-13 19:36:31 +00:00
uxputty.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxsel.c Label random-noise sources with an enum of ids. 2019-01-23 22:36:17 +00:00
uxser.c Make bufchain_prefix return a ptrlen. 2019-02-06 21:46:10 +00:00
uxserver.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
uxsftp.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
uxsftpserver.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
uxshare.c Replace random_byte() with random_read(). 2019-01-23 22:36:17 +00:00
uxsignal.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxstore.c Replace more ad-hoc growing char buffers with strbuf. 2019-02-28 06:42:37 +00:00
uxucs.c Convert a lot of 'int' variables to 'bool'. 2018-11-03 13:45:00 +00:00
uxutils.c Support hardware SHA-256 and SHA-1 on Arm platforms. 2019-01-23 22:36:17 +00:00
x11misc.c New array-growing macros: sgrowarray and sgrowarrayn. 2019-02-28 20:15:38 +00:00
x11misc.h Basic support for running under GDK Wayland back end. 2018-05-09 09:21:27 +01:00
xkeysym.c Support for non-ISO-8859-1 X keysyms. So in particular, pterm in a 2003-04-27 11:10:48 +00:00
xpmptcfg.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
xpmpterm.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
xpmpucfg.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00
xpmputty.c Tweak the icon script, and the generated icons, to more closely 2007-01-07 10:17:12 +00:00