Re: [Planner Dev] libplanner API change proposal



Alvaro del Castillo wrote:

Hi guys!

This morning I have been wasting sometime because I was freeing:

resources_orig = mrp_project_get_resources (plugin->priv->project);
...
g_list_free (resources_orig);

Looking to the function signature, you can't know if the list the API is
given you is a copy or an internal list that can't be freed with very
bad results.

Evolution hackers use:

*_get_*: you get a copy and you have to free it
*_peek_*: you get the original internal pointer and you don't have to
touch it.

For example:

groups = e_source_list_peek_groups (source_list);

gives you and internal pointer (peek)

What do you think about it?

Good convention. I was wondering same things while messing with Windows port. You never know do you have to free it, or better not to free...

In same change I would recommend dropping out those "mrp" prefixes.

--

Jani Tiainen




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