Kaydet (Commit) 9dfa4840 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Missing @since tags, and adapt to semantics of posix_memalign

Change-Id: I677d973fbcf118111b5fc93b09143c66b0afb0d9
üst 757856e9
...@@ -96,14 +96,20 @@ SAL_DLLPUBLIC void SAL_CALL rtl_freeZeroMemory ( ...@@ -96,14 +96,20 @@ SAL_DLLPUBLIC void SAL_CALL rtl_freeZeroMemory (
) SAL_THROW_EXTERN_C(); ) SAL_THROW_EXTERN_C();
/** Allocate memory. /** Allocate aligned memory.
A call to this function will return NULL upon the requested A call to this function will return NULL upon the requested
memory size being either zero or larger than currently allocatable. memory size being either zero or larger than currently allocatable.
@param Alignment alignment in bytes. Memory obtained through this function must be freed with
rtl_freeAlignedMemory.
@param Alignment [in] alignment in bytes, must be a power of two multiple of
sizeof(void*).
@param Bytes [in] memory size. @param Bytes [in] memory size.
@return pointer to allocated memory. @return pointer to allocated memory.
@since LibreOffice 4.3
*/ */
SAL_DLLPUBLIC void* SAL_CALL rtl_allocateAlignedMemory ( SAL_DLLPUBLIC void* SAL_CALL rtl_allocateAlignedMemory (
sal_Size Alignment, sal_Size Alignment,
...@@ -112,8 +118,11 @@ SAL_DLLPUBLIC void* SAL_CALL rtl_allocateAlignedMemory ( ...@@ -112,8 +118,11 @@ SAL_DLLPUBLIC void* SAL_CALL rtl_allocateAlignedMemory (
/** Free memory allocated with rtl_allocateAlignedMemory. /** Free memory allocated with rtl_allocateAlignedMemory.
@param Ptr [in] pointer to previously allocated memory. @param Ptr [in] pointer to previously allocated memory.
@return none. Memory is released. Ptr is invalid. @return none. Memory is released. Ptr is invalid.
@since LibreOffice 4.3
*/ */
SAL_DLLPUBLIC void SAL_CALL rtl_freeAlignedMemory ( SAL_DLLPUBLIC void SAL_CALL rtl_freeAlignedMemory (
void * Ptr void * Ptr
......
...@@ -19,9 +19,16 @@ void* osl_aligned_alloc( sal_Size align, sal_Size size ) ...@@ -19,9 +19,16 @@ void* osl_aligned_alloc( sal_Size align, sal_Size size )
#ifdef __ANDROID__ #ifdef __ANDROID__
return memalign(align, size); return memalign(align, size);
#else #else
if (size == 0)
{
return NULL;
}
else
{
void* ptr; void* ptr;
int err = posix_memalign(&ptr, align, size); int err = posix_memalign(&ptr, align, size);
return err ? NULL : ptr; return err ? NULL : ptr;
}
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment