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 739233 - replace deprecated g_memmove by memmove
replace deprecated g_memmove by memmove
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: client module
git master
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
Depends on:
Blocks:
 
 
Reported: 2014-10-27 09:58 UTC by Andreas Müller
Modified: 2014-11-04 21:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (1.04 KB, patch)
2014-10-27 09:58 UTC, Andreas Müller
accepted-commit_now Details | Review
client: Replace deprecated g_memmove (1.15 KB, patch)
2014-10-30 23:10 UTC, Ross Lagerwall
committed Details | Review

Description Andreas Müller 2014-10-27 09:58:47 UTC
Created attachment 289396 [details] [review]
patch

g_memmove was deprecated in glib-2.0 V 2.40 [1]

[1] https://developer.gnome.org/glib/stable/glib-Memory-Allocation.html#g-memmove
Comment 1 Ondrej Holy 2014-10-30 10:58:10 UTC
Review of attachment 289396 [details] [review]:

Looks good, thanks!
Comment 2 Ross Lagerwall 2014-10-30 13:39:23 UTC
Review of attachment 289396 [details] [review]:

Shouldn't this be a memcpy instead? I don't see why it should be a memmove. Since the destination is newly allocated, the src and dst shouldn't overlap.
Comment 3 Ondrej Holy 2014-10-30 14:21:13 UTC
You are right, memmove isn't necessary and memcpy is faster. Or use g_memdup instead?
Comment 4 Ross Lagerwall 2014-10-30 14:51:53 UTC
(In reply to comment #3)
> You are right, memmove isn't necessary and memcpy is faster. Or use g_memdup
> instead?

Probably not, because we allocate (len + 1) bytes but only want to copy len bytes.
Comment 5 Ross Lagerwall 2014-10-30 23:10:14 UTC
Created attachment 289705 [details] [review]
client: Replace deprecated g_memmove

Replace a hand-rolled partial string duplication with g_strndup.
Comment 6 Ross Lagerwall 2014-10-30 23:11:02 UTC
Or we could use g_strndup to do exactly what's required :-)
Comment 7 Ondrej Holy 2014-10-31 08:42:02 UTC
Review of attachment 289705 [details] [review]:

That's better :-D
Comment 8 Ross Lagerwall 2014-11-04 21:58:20 UTC
Pushed to master as 969421676c9d9f4ee4ca336acb567086af5d6c20. Thanks for the review!