Re: [PATCH 1/6] core: added support for boxed types in GrlData and GrlRelatedKeys



On 24/06/2011 11:42, Iago Toral wrote:
> 
> On Wed, 22 Jun 2011 19:07:51 +0200, Guillaume Emont
> <guijemont igalia com> wrote:
>> ---
>>  src/data/grl-data.c         |   69
>> +++++++++++++++++++++++++++++++++++++++++++
>>  src/data/grl-data.h         |    6 ++++
>>  src/data/grl-related-keys.c |   51 +++++++++++++++++++++++++++++++
>>  src/data/grl-related-keys.h |    7 ++++
>>  4 files changed, 133 insertions(+), 0 deletions(-)
>>
>> diff --git a/src/data/grl-data.c b/src/data/grl-data.c
>> index 9628c83..9897470 100644
>> --- a/src/data/grl-data.c
>> +++ b/src/data/grl-data.c
>> @@ -419,6 +419,53 @@ grl_data_get_binary(GrlData *data, GrlKeyID key,
>> gsize *size)
>>  }
>>
>>  /**
>> + * grl_data_set_boxed:
>> + * @data: data to modify
>> + * @key: key to change or add
>> + * @boxed: the new value
>> + *
>> + * Sets the first boxed value associated with @key in @data. If @key
>> already
>> + * has a value, the old value is freed and the new one is set.
>> + **/
>> +void
>> +grl_data_set_boxed (GrlData *data, GrlKeyID key, gconstpointer boxed)
>> +{
>> +  GValue value = { 0 };
>> +
>> +  if (boxed) {
>> +    g_value_init (&value, GRL_METADATA_KEY_GET_TYPE (key));
>> +    g_value_set_boxed (&value, boxed);
>> +    grl_data_set (data, key, &value);
>> +    g_value_unset (&value);
>> +  }
>> +}
> 
> If a NULL boxed is not allowed then I'd go with g_return_if_fail rather
> than a silent 'if (boxed) ...'.
> The same for all the other set_boxed APIs you added.
Makes sense. Changed them.

Guij
> 
> Iago
> _______________________________________________
> grilo-list mailing list
> grilo-list gnome org
> http://mail.gnome.org/mailman/listinfo/grilo-list
> 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]