mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-01-31 19:43:32 +00:00
23 lines
542 B
C
23 lines
542 B
C
|
#ifndef COSMOPOLITAN_LIBC_MEM_LEAKS_H_
|
||
|
#define COSMOPOLITAN_LIBC_MEM_LEAKS_H_
|
||
|
#include "libc/intrin/weaken.h"
|
||
|
COSMOPOLITAN_C_START_
|
||
|
|
||
|
void CheckForMemoryLeaks(void) libcesque;
|
||
|
|
||
|
/**
|
||
|
* Declares that allocation needn't be freed.
|
||
|
*
|
||
|
* This function does nothing if CheckForMemoryLeaks() hasn't been
|
||
|
* linked into the binary.
|
||
|
*/
|
||
|
forceinline void *may_leak(void *__p) {
|
||
|
void __may_leak(void *) libcesque;
|
||
|
if (_weaken(__may_leak))
|
||
|
_weaken(__may_leak)(__p);
|
||
|
return __p;
|
||
|
}
|
||
|
|
||
|
COSMOPOLITAN_C_END_
|
||
|
#endif /* COSMOPOLITAN_LIBC_MEM_LEAKS_H_ */
|