[glib] Ensure values are memset to 0 when calling G_VALUE_COLLECT_INIT()
- From: Benjamin Otte <otte src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [glib] Ensure values are memset to 0 when calling G_VALUE_COLLECT_INIT()
- Date: Mon, 18 Jan 2010 15:11:28 +0000 (UTC)
commit 914120b9701650ccf7bede1907b69b521ca43236
Author: Benjamin Otte <otte redhat com>
Date: Mon Jan 18 14:03:16 2010 +0100
Ensure values are memset to 0 when calling G_VALUE_COLLECT_INIT()
The reason we need to enforce this is that the GTypeValueTable
documentation explicitly states that memory is memset to 0 when the
value_init function is called.
https://bugzilla.gnome.org/show_bug.cgi?id=603590
gobject/gobject.c | 2 +-
gobject/gsignal.c | 4 ++--
gobject/gvaluecollector.h | 3 +--
3 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/gobject/gobject.c b/gobject/gobject.c
index bf45d62..da2a505 100644
--- a/gobject/gobject.c
+++ b/gobject/gobject.c
@@ -1338,7 +1338,7 @@ g_object_new_valist (GType object_type,
class = g_type_class_ref (object_type);
- params = g_new (GParameter, n_alloced_params);
+ params = g_new0 (GParameter, n_alloced_params);
name = first_property_name;
while (name)
{
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index 9004ee8..c7c1679 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -1971,7 +1971,7 @@ g_signal_chain_from_overridden_handler (gpointer instance,
va_start (var_args, instance);
signal_return_type = node->return_type;
- instance_and_params = g_slice_alloc (sizeof (GValue) * (n_params + 1));
+ instance_and_params = g_slice_alloc0 (sizeof (GValue) * (n_params + 1));
param_values = instance_and_params + 1;
for (i = 0; i < node->n_params; i++)
@@ -2938,7 +2938,7 @@ g_signal_emit_valist (gpointer instance,
n_params = node->n_params;
signal_return_type = node->return_type;
- instance_and_params = g_slice_alloc (sizeof (GValue) * (n_params + 1));
+ instance_and_params = g_slice_alloc0 (sizeof (GValue) * (n_params + 1));
param_values = instance_and_params + 1;
for (i = 0; i < node->n_params; i++)
diff --git a/gobject/gvaluecollector.h b/gobject/gvaluecollector.h
index c0aa790..d7f66e2 100644
--- a/gobject/gvaluecollector.h
+++ b/gobject/gvaluecollector.h
@@ -69,8 +69,7 @@ union _GTypeCValue
/**
* G_VALUE_COLLECT_INIT:
- * @value: a #GValue return location. @value is supposed to be clean (freshly
- * initialized and/or freed).
+ * @value: a #GValue return location. @value must contain only 0 bytes.
* @_value_type: the #GType to use for @value.
* @var_args: the va_list variable; it may be evaluated multiple times
* @flags: flags which are passed on to the collect_value() function of
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]