mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-02 07:23:41 +02:00
changed collect_format, collect_value() and lcopy_format, lcopy_value() in
Sat Feb 17 04:55:35 2001 Tim Janik <timj@gtk.org> * gtype.[hc]: changed collect_format, collect_value() and lcopy_format, lcopy_value() in the GTypeValueTable. the collect functions are now called only once per value, collect_format/lcopy_format are strings that enlist all necessary GTypeCValues to be varargs-collected. * gvalue.h: ranamed STATIC_TAG to G_VALUE_NOCOPY_CONTENTS to indicate that a value shouldn't copy its contents. * gvaluecollector.h: changed G_VALUE_COLLECT() and G_VALUE_LCOPY() macros to carry an additional argument (flags) that can be used to pass G_VALUE_NOCOPY_CONTENTS along to the collection functions. * *.c: adapted collect_value() and lcopy_value() functions to the new prototypes, support G_VALUE_NOCOPY_CONTENTS where apropriate. * gsignal.[hc]: introduced a G_SIGNAL_TYPE_STATIC_SCOPE flag that can be passed along (ORed) with the parameter types, indicating that the emission arguments are to be considered static for the scope of the emission. should be used with care and only if the caller knows that a parameter cannot be destroyed/freed from signal handlers connected to an emission.
This commit is contained in:
@@ -127,26 +127,14 @@ g_value_set_instance (GValue *value,
|
||||
GType g_type = G_VALUE_TYPE (value);
|
||||
GTypeValueTable *value_table = g_type_value_table_peek (g_type);
|
||||
GTypeCValue cvalue = { 0, };
|
||||
guint nth_value = 0;
|
||||
guint collect_type = value_table->collect_type;
|
||||
gchar *error_msg;
|
||||
|
||||
g_return_if_fail (G_TYPE_CHECK_INSTANCE (instance));
|
||||
g_return_if_fail (g_type_is_a (G_TYPE_FROM_INSTANCE (instance), G_VALUE_TYPE (value)));
|
||||
g_return_if_fail (value_table->collect_type == G_VALUE_COLLECT_POINTER);
|
||||
g_return_if_fail (strcmp (value_table->collect_format, "p") == 0);
|
||||
|
||||
cvalue.v_pointer = instance;
|
||||
error_msg = value_table->collect_value (value, nth_value++, &collect_type, &cvalue);
|
||||
|
||||
/* this shouldn't be triggered, instance types should collect just one pointer,
|
||||
* but since we have to follow the calling conventions for collect_value(),
|
||||
* we can attempt to feed them with 0s if they insist on extra args.
|
||||
*/
|
||||
while (collect_type && !error_msg)
|
||||
{
|
||||
memset (&cvalue, 0, sizeof (cvalue));
|
||||
error_msg = value_table->collect_value (value, nth_value++, &collect_type, &cvalue);
|
||||
}
|
||||
error_msg = value_table->collect_value (value, 1, &cvalue, 0);
|
||||
|
||||
if (error_msg)
|
||||
{
|
||||
|
Reference in New Issue
Block a user