g_base_info_clear on zero-initialized stack-allocated introspection info
One thing I'd like to be able to do is have autocleanup of g_base_info_clear()
on stack-allocated GIArgInfo and GITypeInfo. I'm working in C++ so I do this:
class StackArgInfo : public GIArgInfo {
public:
~StackArgInfo() { gi_base_info_clear(this); }
};
So far, so good. But it doesn't account for the use cases of conditionally filling the variable, or moving it out into another variable (analogously to g_steal_pointer()
. This would be helpful when making a StackArgInfo part of a larger stack-allocated struct. I know that's not a primary use case, but it seems like it'd be a minor adjustment. Could we make gi_base_info_clear()
treat a GIBaseInfo filled with zeros as already cleared? (and thus make it idempotent?)