Add a note about casting the results of g_new() and g_new0().

2006-01-17  Matthias Clasen  <mclasen@redhat.com>

	* glib/tmpl/memory.sgml: Add a note about casting the results
	of g_new() and g_new0().
This commit is contained in:
Matthias Clasen 2006-01-18 03:51:39 +00:00 committed by Matthias Clasen
parent f4484f51bf
commit 402a1081ae
6 changed files with 31 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2006-01-17 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_get_groups): Correct a g_new0()
call. (#327421, Morten Welinder)
2006-01-17 Sebastian Wilhelmi <seppi@seppi.de>
* glib/gthreadpool.c: To avoid deadlocks get rid of the settings

View File

@ -1,3 +1,8 @@
2006-01-17 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_get_groups): Correct a g_new0()
call. (#327421, Morten Welinder)
2006-01-17 Sebastian Wilhelmi <seppi@seppi.de>
* glib/gthreadpool.c: To avoid deadlocks get rid of the settings

View File

@ -1,3 +1,8 @@
2006-01-17 Matthias Clasen <mclasen@redhat.com>
* glib/gkeyfile.c (g_key_file_get_groups): Correct a g_new0()
call. (#327421, Morten Welinder)
2006-01-17 Sebastian Wilhelmi <seppi@seppi.de>
* glib/gthreadpool.c: To avoid deadlocks get rid of the settings

View File

@ -1,3 +1,8 @@
2006-01-17 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/memory.sgml: Add a note about casting the results
of g_new() and g_new0().
2006-01-16 Matthias Clasen <mclasen@redhat.com>
* === Released 2.9.3 ===

View File

@ -29,6 +29,11 @@ Allocates @n_structs elements of type @struct_type.
The returned pointer is cast to a pointer to the given type.
If @n_structs is 0 it returns %NULL.
</para>
<para>
Since the returned pointer is already casted to the right type,
it is normally unnecessary to cast it explicitly, and doing
so might hide memory allocation errors.
</para>
@struct_type: the type of the elements to allocate.
@n_structs: the number of elements to allocate.
@ -41,6 +46,11 @@ Allocates @n_structs elements of type @struct_type, initialized to 0's.
The returned pointer is cast to a pointer to the given type.
If @n_structs is 0 it returns %NULL.
</para>
<para>
Since the returned pointer is already casted to the right type,
it is normally unnecessary to cast it explicitly, and doing
so might hide memory allocation errors.
</para>
@struct_type: the type of the elements to allocate.
@n_structs: the number of elements to allocate.

View File

@ -1107,7 +1107,7 @@ g_key_file_get_groups (GKeyFile *key_file,
* list) is always the comment group at the top,
* which we skip
*/
groups = (gchar **) g_new0 (gchar **, num_groups);
groups = g_new0 (gchar *, num_groups);
group_node = g_list_last (key_file->groups);