Skip to content
chrisd1100 edited this page Aug 25, 2022 · 2 revisions

Memory allocation and manipulation.

These functions are mostly thin wrappers around C standard library functions that have platform differences. Additionally, functions like MTY_Alloc wrap calloc but abort() on failure.

Functions

Name Brief
MTY_SecureZero Guarantee memory is zeroed without compiler interference.
MTY_Alloc Allocate zeroed memory.
MTY_AllocAligned Allocate zeroed aligned memory.
MTY_Free Free allocated memory.
MTY_FreeAligned Free aligned allocated memory.
MTY_SecureFree Guarantee allocated memory is zeroed before it is freed.
MTY_Realloc Resize previously allocated memory.
MTY_Dup Duplicate a buffer.
MTY_Strdup Duplicate a string.
MTY_Strcat Append to a string.
MTY_VsprintfD Dynamically format a string with a va_list.
MTY_SprintfD Dynamically format a string.
MTY_SprintfDL Dynamically format a string and put the result in thread local storage.
MTY_Strcasecmp Case insensitive string comparison.
MTY_Strcasestr Case insensitive substring search.
MTY_Strtok Reentrant string tokenization.
MTY_Sort Stable qsort.
MTY_WideToMulti Convert a wide character string to its UTF-8 equivalent.
MTY_WideToMultiD Dynamic version of MTY_WideToMulti.
MTY_WideToMultiDL Thread local version of MTY_WideToMulti.
MTY_MultiToWide Convert a UTF-8 string to its wide character equivalent.
MTY_MultiToWideD Dynamic version of MTY_MultiToWide.
MTY_MultiToWideDL Thread local version of MTY_MultiToWide.
MTY_Swap16 Get the bytes of a 16-bit integer in reverse order.
MTY_Swap32 Get the bytes of a 32-bit integer in reverse order.
MTY_Swap64 Get the bytes of a 64-bit integer in reverse order.
MTY_SwapToBE16 Get the big-endian representation of a native 16-bit integer.
MTY_SwapToBE32 Get the big-endian representation of a native 32-bit integer.
MTY_SwapToBE64 Get the big-endian representation of a native 64-bit integer.
MTY_SwapFromBE16 Get the native representation of a big-endian 16-bit integer.
MTY_SwapFromBE32 Get the native representation of a big-endian 32-bit integer.
MTY_SwapFromBE64 Get the native representation of a big-endian 64-bit integer.

Function Typedefs

Name Brief
MTY_CompareFunc Function called while running MTY_Sort.
Clone this wiki locally