diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/allocator.c | 7 | ||||
-rw-r--r-- | src/ring.c | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/allocator.c b/src/allocator.c index ca91803..af6b8a9 100644 --- a/src/allocator.c +++ b/src/allocator.c @@ -60,9 +60,10 @@ zix_default_aligned_alloc(ZixAllocator* const allocator, #if defined(_WIN32) return _aligned_malloc(size, alignment); #elif USE_POSIX_MEMALIGN - void* ptr = NULL; - const int ret = posix_memalign(&ptr, alignment, size); - return ret ? NULL : ptr; + // POSIX.1-2008 TC2 says that ptr is not modified on failure + void* ptr = NULL; + posix_memalign(&ptr, alignment, size); + return ptr; #else return NULL; #endif @@ -275,10 +275,10 @@ zix_ring_write(ZixRing* const ring, const void* src, const uint32_t size) { ZixRingTransaction tx = zix_ring_begin_write(ring); - if (zix_ring_amend_write(ring, &tx, src, size) || - zix_ring_commit_write(ring, &tx)) { + if (zix_ring_amend_write(ring, &tx, src, size)) { return 0; } + zix_ring_commit_write(ring, &tx); return size; } |