ROFL-pipeline  v0.6.0dev
memory.h
Go to the documentation of this file.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2  * License, v. 2.0. If a copy of the MPL was not distributed with this
3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 
5 #ifndef PLATFORM_MEMORY_H_
6 #define PLATFORM_MEMORY_H_
7 
8 #include <stddef.h>
9 #include <stdlib.h>
10 #include "rofl.h"
11 
39 //C++ extern C
40 ROFL_BEGIN_DECLS
41 
48 void* platform_malloc( size_t length );
49 
56 void* platform_malloc_shared( size_t length );
57 
58 
66 void platform_free( void* data );
67 
75 void platform_free_shared( void* data );
76 
81 void* platform_memcpy( void* dst, const void* src, size_t length );
82 
87 void* platform_memset( void* src, int c, size_t length );
88 
96 void* platform_memmove( void* dst, const void* src, size_t length );
97 
98 //C++ extern C
99 ROFL_END_DECLS
100 
101 #endif /* PLATFORM_MEMORY_H_ */
void * platform_memset(void *src, int c, size_t length)
Sets 'c' to the whole chunk of memory.
ROFL_BEGIN_DECLS void * platform_malloc(size_t length)
Allocates a chunk of dynamic memory of size length.
void * platform_memcpy(void *dst, const void *src, size_t length)
Copies a chunk of memory.
void * platform_memmove(void *dst, const void *src, size_t length)
Moves a chunk of memory from src to dst.
void platform_free(void *data)
Frees a chunk of dynamic memory previously allocated with platform_malloc().
void * platform_malloc_shared(size_t length)
Allocates a chunk of dynamic memory of size length, which must be accessible (R/W) for all the thread...
void platform_free_shared(void *data)
Frees a chunk of dynamic memory previously allocated with platform_malloc_shared().