ghash: Add APIs to get (and steal) hash table keys and values as GPtrArray
GPtrArray's are faster than lists and provide more flexibility, so add APIs to get hash keys and values using these containers too.
Given that we know the size at array initialization we can optimize the allocation quite a bit, making it faster than the API using GList both at creation time and for consumers.
As per this is quite simple to implement stealing functions too, that allow to pass the ownership of the elements safely from a container to another.
And use these functions in few places around.