Re: 2.x API and GDateTime



On Sun, 2012-12-16 at 17:07 +0100, Juan A. Suarez Romero wrote:
> On Sun, 2012-12-16 at 15:25 +0100, Roland Peffer wrote:
> > Thanks for the answer.
> > I checked again:
> > 
> >  grl_media_set_creation_date (media);  increases the reference counter.
> > 
> >  grl_media_get_creation_date(media)  leaves reference counter untouched.
> > 
> > 
> > For my understanding this is not correct.
> > Either grl_media_get_creation_date should be marked with const ,
> 
> 
> Probably it would make sense.

It should just return a new reference. Anything else is broken.

> But to avoid changing the API in this moment, I will fix the
> documentation so it makes clearly that returned value shouldn't be
> modified at all.
> 
> > or better also should increase the ref counter on the GDateTime object.
> 
> This option would make this function behave different than the other
> grl_media_get_foo() functions.
> 
> In these functions the returned type is sort of "const". The returned
> data is just to be used as read-only mode, and shouldn't it be freed.

None of those functions return something that's akin to an object,
GDateTime is an object with reference counting, and the convention is to
return a new reference.

Cheers



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