1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Merge 0.81 branch.

This commit is contained in:
Simon Tatham
2024-04-15 19:42:50 +01:00
20 changed files with 925 additions and 215 deletions

View File

@ -2,6 +2,12 @@
* PuTTY's memory allocation wrappers.
*/
#ifdef ALLOCATION_ALIGNMENT
/* Before we include standard headers, define _ISOC11_SOURCE so that
* we get the declaration of aligned_alloc(). */
#define _ISOC11_SOURCE
#endif
#include <assert.h>
#include <stdlib.h>
#include <limits.h>
@ -28,6 +34,8 @@ void *safemalloc(size_t factor1, size_t factor2, size_t addend)
void *p;
#ifdef MINEFIELD
p = minefield_c_malloc(size);
#elif defined ALLOCATION_ALIGNMENT
p = aligned_alloc(ALLOCATION_ALIGNMENT, size);
#else
p = malloc(size);
#endif
@ -52,6 +60,8 @@ void *saferealloc(void *ptr, size_t n, size_t size)
if (!ptr) {
#ifdef MINEFIELD
p = minefield_c_malloc(size);
#elif defined ALLOCATION_ALIGNMENT
p = aligned_alloc(ALLOCATION_ALIGNMENT, size);
#else
p = malloc(size);
#endif