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 671545 - Constify collect and lcopy strings in GTypeValueTable
Constify collect and lcopy strings in GTypeValueTable
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gobject
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-03-07 12:57 UTC by Emmanuele Bassi (:ebassi)
Modified: 2012-07-06 03:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Constify collect and lcopy strings in GTypeValueTable (3.24 KB, patch)
2012-03-07 12:57 UTC, Emmanuele Bassi (:ebassi)
accepted-commit_now Details | Review
Constify collect and lcopy strings in GTypeValueTable (3.24 KB, patch)
2012-07-06 03:33 UTC, Matthias Clasen
committed Details | Review

Description Emmanuele Bassi (:ebassi) 2012-03-07 12:57:19 UTC
This avoids warnings when compiling with -Wwrite-strings, and ensures that people don't mess around with the collection and lcopy strings.
Comment 1 Emmanuele Bassi (:ebassi) 2012-03-07 12:57:21 UTC
Created attachment 209154 [details] [review]
Constify collect and lcopy strings in GTypeValueTable

This avoids warnings when creating idiomatic value tables, like:

  static const GTypeValueTable _clutter_shader_float_value_table = {
    clutter_value_init_shader_float,
    clutter_value_free_shader_float,
    clutter_value_copy_shader_float,
    clutter_value_peek_pointer,
    "ip",
    clutter_value_collect_shader_float,
    "pp",
    clutter_value_lcopy_shader_float
  };

Because the strings are literals. And, really: nobody should be using
allocated values for the collection and lcopy strings.
Comment 2 Matthias Clasen 2012-06-30 05:24:02 UTC
Review of attachment 209154 [details] [review]:

Sure, looks fine to me
Comment 3 Matthias Clasen 2012-07-06 03:33:10 UTC
The following fix has been pushed:
2a87010 Constify collect and lcopy strings in GTypeValueTable
Comment 4 Matthias Clasen 2012-07-06 03:33:13 UTC
Created attachment 218146 [details] [review]
Constify collect and lcopy strings in GTypeValueTable

This avoids warnings when creating idiomatic value tables, like:

  static const GTypeValueTable _clutter_shader_float_value_table = {
    clutter_value_init_shader_float,
    clutter_value_free_shader_float,
    clutter_value_copy_shader_float,
    clutter_value_peek_pointer,
    "ip",
    clutter_value_collect_shader_float,
    "pp",
    clutter_value_lcopy_shader_float
  };

Because the strings are literals. And, really: nobody should be using
allocated values for the collection and lcopy strings.