diff options
author | Kjell Ahlstedt <kjell.ahlstedt@bredband.net> | 2013-07-10 08:37:53 +0200 |
---|---|---|
committer | Kjell Ahlstedt <kjell.ahlstedt@bredband.net> | 2013-07-10 08:37:53 +0200 |
commit | a38f51a9c3833ce581610e368eee1dc360d4de55 (patch) | |
tree | 43a86894b637fcfaa700c27fc49ee176b6dfc870 /glib | |
parent | 6346c25f5835a48df6e75d5cac286cc883f17020 (diff) | |
download | glibmm-a38f51a9c3833ce581610e368eee1dc360d4de55.tar.gz |
Use std::memset() instead of GLIBMM_INITIALIZE_STRUCT.
* glib/glibmm/utility.h: Add a comment that GLIBMM_INITIALIZE_STRUCT is
deprecated. It generates compiler warnings when __STRICT_ANSI__ is defined.
* glib/glibmm/value.cc:
* glib/src/optiongroup.ccg:
* tools/m4/class_boxedtype_static.m4: Replace GLIBMM_INITIALIZE_STRUCT
by std::memset().
Diffstat (limited to 'glib')
-rw-r--r-- | glib/glibmm/utility.h | 4 | ||||
-rw-r--r-- | glib/glibmm/value.cc | 6 | ||||
-rw-r--r-- | glib/src/optiongroup.ccg | 3 |
3 files changed, 9 insertions, 4 deletions
diff --git a/glib/glibmm/utility.h b/glib/glibmm/utility.h index 723418d2..f5aa2a88 100644 --- a/glib/glibmm/utility.h +++ b/glib/glibmm/utility.h @@ -29,6 +29,10 @@ * i.e. when using structs as class member data. For convenience, the macro * GLIBMM_INITIALIZE_STRUCT(Var, Type) is provided. It even avoids creating * a temporary if the compiler is GCC. + * + * Deprecated: Use e.g. std::memset() instead. + * It's not used any more in the code generated by _CLASS_BOXEDTYPE_STATIC. + * It generates compiler warnings if __STRICT_ANSI__ is defined. */ #if ((__GNUC__ >= 3) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) && !defined(__STRICT_ANSI__) diff --git a/glib/glibmm/value.cc b/glib/glibmm/value.cc index 6a0f87c1..811b82d2 100644 --- a/glib/glibmm/value.cc +++ b/glib/glibmm/value.cc @@ -22,7 +22,7 @@ #include <glibmm/objectbase.h> #include <glibmm/utility.h> #include <glibmm/wrap.h> - +#include <cstring> // std::memset() namespace Glib { @@ -31,7 +31,7 @@ namespace Glib ValueBase::ValueBase() { - GLIBMM_INITIALIZE_STRUCT(gobject_, GValue); + std::memset(&gobject_, 0, sizeof(GValue)); } void ValueBase::init(GType type) @@ -49,7 +49,7 @@ void ValueBase::init(const GValue* value) ValueBase::ValueBase(const ValueBase& other) { - GLIBMM_INITIALIZE_STRUCT(gobject_, GValue); + std::memset(&gobject_, 0, sizeof(GValue)); g_value_init(&gobject_, G_VALUE_TYPE(&other.gobject_)); g_value_copy(&other.gobject_, &gobject_); diff --git a/glib/src/optiongroup.ccg b/glib/src/optiongroup.ccg index baa1331c..d2f81ffb 100644 --- a/glib/src/optiongroup.ccg +++ b/glib/src/optiongroup.ccg @@ -21,6 +21,7 @@ #include <glibmm/exceptionhandler.h> //#include <glibmm/containers.h> #include <glib.h> // g_malloc +#include <cstring> // std::memset() namespace Glib { @@ -308,7 +309,7 @@ void OptionGroup::add_entry(const OptionEntry& entry) //Create a temporary array, just so we can give the correct thing to g_option_group_add_entries: GOptionEntry array[2]; array[0] = *(entry.gobj()); //Copy contents. - GLIBMM_INITIALIZE_STRUCT(array[1], GOptionEntry); + std::memset(&array[1], 0, sizeof(GOptionEntry)); g_option_group_add_entries(gobj(), array); } |