Re: Does g_key_file_free() free pointers from g_key_file_get_string()?
- From: Iam Liu Rodrigues <ian liu88 gmail com>
- To: Tadej Borovšak <tadeboro gmail com>
- Cc: Kris Bahnsen <nevrgonastopme00 gmail com>, "gtk-list gnome org" <gtk-list gnome org>
- Subject: Re: Does g_key_file_free() free pointers from g_key_file_get_string()?
- Date: Fri, 17 Jun 2011 07:34:06 -0300
> Another indicator that returned value should be freed is lack of const
> modifier on return value.
>
> If API docs state:
>
> const char * get_something () -> do not free result
> char * get_another_thing () -> free result
Not always. There are some string utilities functions which modify string in place and returns itself, such as g_strstrip. The value should be freed whenever "newly allocated" is specified in the return value.
Ian L.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]