mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
19 lines
334 B
C
19 lines
334 B
C
#pragma once
|
|
|
|
#ifndef FASTFETCH_INCLUDED_UTIL_MALLOC_HELPER
|
|
#define FASTFETCH_INCLUDED_UTIL_MALLOC_HELPER
|
|
|
|
#include <stdlib.h>
|
|
#include <assert.h>
|
|
|
|
static inline void ffWrapFree(void* pPtr)
|
|
{
|
|
assert(pPtr);
|
|
if(*(void**)pPtr)
|
|
free(*(void**)pPtr);
|
|
}
|
|
|
|
#define FF_AUTO_FREE __attribute__((__cleanup__(ffWrapFree)))
|
|
|
|
#endif
|