GNOME Bugzilla – Bug 615902
[PATCH] add array steal and memdup functions
Last modified: 2018-05-24 12:13:35 UTC
These are useful when a function must write repeatedly into an array. Testcases included.
Created attachment 158856 [details] [review] patch
steal() is useful, memdup() is borderline, memcpy() is dangerous. The user of memcpy() needs to have computed the size of the destination anyway, so they can simply call memcpy() themselves.
I don't particularly like that g_array_steal() returns gchar*. I'd rather see guint8* or gpointer.
Created attachment 162367 [details] [review] updated patch removing memcpy This version of the patch removes memcpy and changes the return type for GArray functions.
ping?
Bug 795376 ended up adding g_ptr_array_steal() independently. We should still add g_array_steal() as well. I don't think we should have a memdup() API, though.
Review of attachment 162367 [details] [review]: Needs to be rebased on master; needs a better commit message.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/glib/issues/285.