libvips
libvips copied to clipboard
Use glib autoptr
We could start using glib's autoptr system. We'd need to require compiler support in meson.build with something like:
cc.has_header_symbol(
'glib.h', 'G_DEFINE_AUTOPTR_CLEANUP_FUNC',
dependencies : glib_dep,
required : true,
)
gcc and clang both support this, I'm not sure about other compilers.
autoptr is a nice way to automatically trigger cleanup functions for values allocated on the stack. It makes code easier to read and removes a class of memory leaks.