* lib/ssfmalloc.h: Add parameter PAGESIZE_MAX.
(pg_offset_t): Define depending on PAGESIZE_MAX.
* tests/test-ssfmalloc.c: Undefine PAGESIZE.
(PAGESIZE_MAX): New macro.
2020-10-25 Bruno Haible <bruno@clisp.org>
+ ssfmalloc: Portability to Cygwin.
+ * lib/ssfmalloc.h: Add parameter PAGESIZE_MAX.
+ (pg_offset_t): Define depending on PAGESIZE_MAX.
+ * tests/test-ssfmalloc.c: Undefine PAGESIZE.
+ (PAGESIZE_MAX): New macro.
+
ssfmalloc: Fix buffer overrun in bitmap search.
* lib/ssfmalloc-bitmap.h (find_first_packet_set): Don't access the
word *words_end.
PAGESIZE A variable-like macro of type intptr_t or uintptr_t
that evaluates to the memory page size (>= 4096).
+ PAGESIZE_MAX A constant that specifies an upper bound for PAGESIZE.
+
ALLOC_PAGES A function-like macro with the signature
uintptr_t ALLOC_PAGES (size_t size)
where the argument size is > 0 and a multiple of the
/* ========================= Small and medium blocks ======================== */
/* An integer type, capable of holding the values 0 .. PAGESIZE. */
+#if PAGESIZE_MAX >= 0x10000
+typedef unsigned int pg_offset_t;
+#else
typedef unsigned short pg_offset_t;
+#endif
/* Tree element that corresponds to a page.
These tree elements are allocated via malloc(). */
#endif
}
+/* Cygwin defines PAGESIZE in <limits.h>. */
+#undef PAGESIZE
+
/* ======================= Instantiate the front end ======================= */
#define PAGESIZE pagesize
+/* On Cygwin, PAGESIZE is 65536. On all other platforms, it is either 4096
+ or 8192. */
+#ifdef __CYGWIN__
+# define PAGESIZE_MAX 65536
+#else
+# define PAGESIZE_MAX 8192
+#endif
+
#define ALLOC_PAGES alloc_pages
#define FREE_PAGES free_pages
#define ALIGNMENT (sizeof (void *)) /* or 8 or 16 or 32 */
#define PAGE_RESERVED_HEADER_SIZE (3 * UINTPTR_WIDTH / 8) /* = 3 * sizeof (void *) */
+
#include "ssfmalloc.h"
/* ================================= Tests ================================= */