mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
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]
This commit is contained in:
parent
29184e3702
commit
c10a8dee07
@ -37,6 +37,7 @@ void safefree(void *);
|
|||||||
*/
|
*/
|
||||||
#define snew(type) ((type *)snmalloc(1, sizeof(type)))
|
#define snew(type) ((type *)snmalloc(1, sizeof(type)))
|
||||||
#define snewn(n, type) ((type *)snmalloc((n), sizeof(type)))
|
#define snewn(n, type) ((type *)snmalloc((n), sizeof(type)))
|
||||||
#define sresize(ptr, n, type) ((type *)snrealloc((ptr), (n), sizeof(type)))
|
#define sresize(ptr, n, type) \
|
||||||
|
((type *)snrealloc((sizeof((type *)0 == (ptr)), (ptr)), (n), sizeof(type)))
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user