Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sal / osl / unx / memory.cxx
blobbe3e41fb5e8ba87553029e2c089f8b040b37d4bb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #include <oslmemory.h>
12 #include <stdlib.h>
13 #ifdef __ANDROID__
14 #include <malloc.h>
15 #endif
17 void* osl_aligned_alloc(sal_Size align, sal_Size size)
19 if (size == 0)
21 return nullptr;
24 #if defined __ANDROID__
25 return memalign(align, size);
26 #else
27 void* ptr;
28 int err = posix_memalign(&ptr, align, size);
29 return err ? nullptr : ptr;
30 #endif
33 void osl_aligned_free(void* p) { free(p); }
35 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */