17#define _POSIX_C_SOURCE 200809L
24#if USE_POSIX_FADVISE && USE_FILENO
40 FILE* fd = fopen(path,
mode);
43 stderr,
"error: failed to open file %s (%s)\n", path, strerror(errno));
47#if USE_POSIX_FADVISE && USE_FILENO
48 posix_fadvise(fileno(fd), 0, 0, POSIX_FADV_SEQUENTIAL);
57 return _aligned_malloc(
size, alignment);
58#elif USE_POSIX_MEMALIGN
60 const int ret = posix_memalign(&ptr, alignment,
size);
61 return ret ?
NULL : ptr;
png_structrp int mode
Definition png.h:1139
FILE * serd_fopen(const char *path, const char *mode)
Open a file configured for fast sequential reading.
Definition system.c:38
void * serd_malloc_aligned(const size_t alignment, const size_t size)
Allocate a buffer aligned to alignment bytes.
Definition system.c:54
void * serd_allocate_buffer(const size_t size)
Allocate an aligned buffer for I/O.
Definition system.c:69
void serd_free_aligned(void *const ptr)
Free a buffer allocated with an aligned allocation function.
Definition system.c:75
#define void
Definition unzip.h:396