Files
fastfetch/src/util/mallocHelper.h
T

19 lines
334 B
C
Raw Normal View History

#pragma once
#ifndef FASTFETCH_INCLUDED_UTIL_MALLOC_HELPER
#define FASTFETCH_INCLUDED_UTIL_MALLOC_HELPER
2022-11-23 15:10:40 +08:00
#include <stdlib.h>
2023-06-08 21:04:56 +08:00
#include <assert.h>
2022-11-23 15:10:40 +08:00
static inline void ffWrapFree(void* pPtr)
{
assert(pPtr);
2022-11-23 15:10:40 +08:00
if(*(void**)pPtr)
free(*(void**)pPtr);
}
#define FF_AUTO_FREE __attribute__((__cleanup__(ffWrapFree)))
#endif