After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 615902 - [PATCH] add array steal and memdup functions
[PATCH] add array steal and memdup functions
Status: RESOLVED OBSOLETE
Product: glib
Classification: Platform
Component: garray
2.24.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-04-15 22:31 UTC by Paolo Bonzini
Modified: 2018-05-24 12:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (15.54 KB, patch)
2010-04-15 22:35 UTC, Paolo Bonzini
none Details | Review
updated patch removing memcpy (12.75 KB, patch)
2010-05-31 11:08 UTC, Paolo Bonzini
needs-work Details | Review

Description Paolo Bonzini 2010-04-15 22:31:36 UTC
These are useful when a function must write repeatedly into an array.

Testcases included.
Comment 1 Paolo Bonzini 2010-04-15 22:35:24 UTC
Created attachment 158856 [details] [review]
patch
Comment 2 Behdad Esfahbod 2010-05-29 17:27:48 UTC
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.
Comment 3 Christian Hergert 2010-05-29 20:46:11 UTC
I don't particularly like that g_array_steal() returns gchar*.  I'd rather see guint8* or gpointer.
Comment 4 Paolo Bonzini 2010-05-31 11:08:55 UTC
Created attachment 162367 [details] [review]
updated patch removing memcpy

This version of the patch removes memcpy and changes the return type for GArray functions.
Comment 5 Paolo Bonzini 2011-01-20 17:26:01 UTC
ping?
Comment 6 Emmanuele Bassi (:ebassi) 2018-05-15 08:20:46 UTC
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.
Comment 7 Emmanuele Bassi (:ebassi) 2018-05-15 08:21:34 UTC
Review of attachment 162367 [details] [review]:

Needs to be rebased on master; needs a better commit message.
Comment 8 GNOME Infrastructure Team 2018-05-24 12:13:35 UTC
-- 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.