MeshLib C Docs
Loading...
Searching...
No Matches
common.h File Reference
#include <MRCMisc/exports.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef int64_t MR_int64_t
 
typedef uint64_t MR_uint64_t
 
typedef enum MR_PassBy MR_PassBy
 

Enumerations

enum  MR_PassBy {
  MR_PassBy_DefaultConstruct , MR_PassBy_Copy , MR_PassBy_Move , MR_PassBy_DefaultArgument ,
  MR_PassBy_NoObject
}
 

Functions

MRC_API void * MR_Alloc (size_t num_bytes)
 Allocates n bytes of memory, which can then be freed using MR_Free().
 
MRC_API void MR_Free (void *ptr)
 Deallocates memory that was previously allocated with MR_Alloc(). Does nothing if the pointer is null.
 
MRC_API void * MR_AllocArray (size_t num_bytes)
 
MRC_API void MR_FreeArray (void *ptr)
 Deallocates memory that was previously allocated with MR_AllocArray(). Does nothing if the pointer is null.
 

Typedef Documentation

◆ MR_int64_t

typedef int64_t MR_int64_t

◆ MR_PassBy

typedef enum MR_PassBy MR_PassBy

◆ MR_uint64_t

typedef uint64_t MR_uint64_t

Enumeration Type Documentation

◆ MR_PassBy

enum MR_PassBy
Enumerator
MR_PassBy_DefaultConstruct 
MR_PassBy_Copy 
MR_PassBy_Move 
MR_PassBy_DefaultArgument 
MR_PassBy_NoObject 

Function Documentation

◆ MR_Alloc()

MRC_API void * MR_Alloc ( size_t num_bytes)

Allocates n bytes of memory, which can then be freed using MR_Free().

◆ MR_AllocArray()

MRC_API void * MR_AllocArray ( size_t num_bytes)

Allocates n bytes of memory, which can then be freed using MR_FreeArray(). For all purposes this is equivalent to MR_Alloc() and MR_Free(), but the deallocation functions are not interchangable. This is a bit weird, but we have to have separate deallocation functions for arrays and non-arrays, because ASAN complains otherwise. So the allocation functions must be provided separately for both too.

◆ MR_Free()

MRC_API void MR_Free ( void * ptr)

Deallocates memory that was previously allocated with MR_Alloc(). Does nothing if the pointer is null.

◆ MR_FreeArray()

MRC_API void MR_FreeArray ( void * ptr)

Deallocates memory that was previously allocated with MR_AllocArray(). Does nothing if the pointer is null.