aboutsummaryrefslogtreecommitdiffstats
path: root/src/system.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-26 19:23:13 +0100
committerDavid Robillard <d@drobilla.net>2020-12-31 13:25:56 +0100
commitd101d926946a5e8067a90d157b6553aae7bddc19 (patch)
treee997425e9f972e402830d9ab8cb65005068e9619 /src/system.c
parent8a93d0b3be5b6d80a1bef85bc73b2661f5ab4376 (diff)
downloadserd-d101d926946a5e8067a90d157b6553aae7bddc19.tar.gz
serd-d101d926946a5e8067a90d157b6553aae7bddc19.tar.bz2
serd-d101d926946a5e8067a90d157b6553aae7bddc19.zip
Format all code with clang-format
Diffstat (limited to 'src/system.c')
-rw-r--r--src/system.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/system.c b/src/system.c
index c6796da9..3f10b86b 100644
--- a/src/system.c
+++ b/src/system.c
@@ -22,11 +22,11 @@
#include "serd_internal.h"
#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO)
-# include <fcntl.h>
+# include <fcntl.h>
#endif
#ifdef _WIN32
-# include <malloc.h>
+# include <malloc.h>
#endif
#include <errno.h>
@@ -37,47 +37,48 @@
FILE*
serd_fopen(const char* path, const char* mode)
{
- FILE* fd = fopen(path, mode);
- if (!fd) {
- fprintf(stderr, "error: failed to open file %s (%s)\n",
- path, strerror(errno));
- return NULL;
- }
+ FILE* fd = fopen(path, mode);
+ if (!fd) {
+ fprintf(
+ stderr, "error: failed to open file %s (%s)\n", path, strerror(errno));
+ return NULL;
+ }
+
#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO)
- posix_fadvise(fileno(fd), 0, 0, POSIX_FADV_SEQUENTIAL);
+ posix_fadvise(fileno(fd), 0, 0, POSIX_FADV_SEQUENTIAL);
#endif
- return fd;
+ return fd;
}
void*
serd_malloc_aligned(const size_t alignment, const size_t size)
{
#if defined(_WIN32)
- return _aligned_malloc(size, alignment);
+ return _aligned_malloc(size, alignment);
#elif __STDC_VERSION__ >= 201112L && defined(HAVE_ALIGNED_ALLOC)
- return aligned_alloc(alignment, size);
+ return aligned_alloc(alignment, size);
#elif defined(HAVE_POSIX_MEMALIGN)
- void* ptr = NULL;
- const int ret = posix_memalign(&ptr, alignment, size);
- return ret ? NULL : ptr;
+ void* ptr = NULL;
+ const int ret = posix_memalign(&ptr, alignment, size);
+ return ret ? NULL : ptr;
#else
- (void)alignment;
- return malloc(size);
+ (void)alignment;
+ return malloc(size);
#endif
}
void*
serd_allocate_buffer(const size_t size)
{
- return serd_malloc_aligned(SERD_PAGE_SIZE, size);
+ return serd_malloc_aligned(SERD_PAGE_SIZE, size);
}
void
serd_free_aligned(void* const ptr)
{
#ifdef _WIN32
- _aligned_free(ptr);
+ _aligned_free(ptr);
#else
- free(ptr);
+ free(ptr);
#endif
}