1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00
Commit Graph

9 Commits

Author SHA1 Message Date
Simon Tatham
452114c3d3 New memory management macro 'snew_plus'.
This formalises my occasional habit of using a single malloc to make a
block that contains a header structure and a data buffer that a field
of the structure will point to, allowing it to be freed in one go
later. Previously I had to do this by hand, losing the type-checking
advantages of snew; now I've written an snew-style macro to do the
job, plus an accessor macro to cleanly get the auxiliary buffer
pointer afterwards, and switched existing instances of the pattern
over to using that.
2018-06-06 07:22:06 +01:00
Simon Tatham
f40d49b704 Rework the new type-check in sresize so that it doesn't cause a
compile warning ('left-hand operand of comma expression has no
effect'), which of course becomes fatal under -Werror.

(This would have been instantly noticeable to people compiling with
the old-fashioned Makefile.gtk, which does include -Wall -Werror, but
those of us using the new autoconf makefile hadn't noticed.)

[originally from svn r9582]
2012-07-19 04:29:50 +00:00
Simon Tatham
c10a8dee07 Enhance my 'sresize' macro so that it type-checks the pointer you pass
_in_ to it, as well as the one it returns. Why have I never thought of
doing that before?!

[originally from svn r9539]
2012-05-18 19:51:11 +00:00
Jacob Nevins
eec73ea3b6 Missing argument in MALLOC_LOG version of snrealloc() macro.
[originally from svn r6075]
2005-07-06 18:26:41 +00:00
Simon Tatham
893d187b81 Additional robustness to SFTP packet parsing and memory allocation.
[originally from svn r5358]
2005-02-20 10:30:05 +00:00
Simon Tatham
d36a4c3685 Introduced wrapper macros snew(), snewn() and sresize() for the
malloc functions, which automatically cast to the same type they're
allocating the size of. Should prevent any future errors involving
mallocing the size of the wrong structure type, and will also make
life easier if we ever need to turn the PuTTY core code from real C
into C++-friendly C. I haven't touched the Mac frontend in this
checkin because I couldn't compile or test it.

[originally from svn r3014]
2003-03-29 16:14:26 +00:00
Simon Tatham
3730ada5ce Run entire source base through GNU indent to tidy up the varying
coding styles of the various contributors! Woohoo!

[originally from svn r1098]
2001-05-06 14:35:20 +00:00
Simon Tatham
ea2e1dd9ae Dave Hinton's debugging patch.
[originally from svn r1079]
2001-04-28 09:24:19 +00:00
Simon Tatham
d5240d4157 Make memory management uniform: _everything_ now goes through the
smalloc() macros and thence to the safemalloc() functions in misc.c.
This should allow me to plug in a debugging allocator and track
memory leaks and segfaults and things.

[originally from svn r818]
2000-12-12 10:33:13 +00:00