build: Cleanups and use g_memdup2 when building with newer glib
See commit messages, not bumping glib required version yet.
This could be done as a future cleanup work, where we may for example support autopointers.
See commit messages, not bumping glib required version yet.
This could be done as a future cleanup work, where we may for example support autopointers.