3 ms·
GCC and LLVM offer a "cleanup in this scope" attribute, so you can write: __attribute__((cleanup(free_indirect))) char *foo = strdup ("bar"); where free_i
by rwmj 14y ago
GCC and LLVM offer a "cleanup in this scope" attribute, so you can write:
__attribute__((cleanup(free_indirect))) char *foo = strdup ("bar");
where free_indirect is a simple wrapper around free. It's used in the systemd code (making it GCC/LLVM-specific of course).
http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html