mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-21 09:27:51 +02:00
Add g_try_new, g_try_new0 and g_try_renew. (#169611, Stefan Kost)
2005-03-21 Matthias Clasen <mclasen@redhat.com> * glib/gmem.h: Add g_try_new, g_try_new0 and g_try_renew. (#169611, Stefan Kost)
This commit is contained in:
committed by
Matthias Clasen
parent
169da6ebcb
commit
103fe49b8e
@@ -1,3 +1,9 @@
|
||||
2005-03-21 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* glib/glib-sections.txt:
|
||||
* glib/tmpl/memory.sgml: Document g_try_new, g_try_new0
|
||||
and g_try_renew.
|
||||
|
||||
2005-03-20 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* gobject/tmpl/gparamspec.sgml: Document G_PARAM_SPEC_STATIC_
|
||||
|
@@ -763,6 +763,9 @@ g_io_watch_funcs
|
||||
g_new
|
||||
g_new0
|
||||
g_renew
|
||||
g_try_new
|
||||
g_try_new0
|
||||
g_try_renew
|
||||
|
||||
<SUBSECTION>
|
||||
g_malloc
|
||||
|
@@ -24,7 +24,7 @@ This also means that there is no need to check if the call succeeded.
|
||||
<para>
|
||||
Allocates @n_structs elements of type @struct_type.
|
||||
The returned pointer is cast to a pointer to the given type.
|
||||
If @count is 0 it returns %NULL.
|
||||
If @n_structs is 0 it returns %NULL.
|
||||
</para>
|
||||
|
||||
@struct_type: the type of the elements to allocate.
|
||||
@@ -36,7 +36,7 @@ If @count is 0 it returns %NULL.
|
||||
<para>
|
||||
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 @count is 0 it returns %NULL.
|
||||
If @n_structs is 0 it returns %NULL.
|
||||
</para>
|
||||
|
||||
@struct_type: the type of the elements to allocate.
|
||||
@@ -47,7 +47,7 @@ If @count is 0 it returns %NULL.
|
||||
<!-- ##### MACRO g_renew ##### -->
|
||||
<para>
|
||||
Reallocates the memory pointed to by @mem, so that it now has space for
|
||||
@n_struct elements of type @struct_type. It returns the new address of
|
||||
@n_structs elements of type @struct_type. It returns the new address of
|
||||
the memory, which may have been moved.
|
||||
</para>
|
||||
|
||||
@@ -57,6 +57,50 @@ the memory, which may have been moved.
|
||||
@Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type.
|
||||
|
||||
|
||||
<!-- ##### MACRO g_try_new ##### -->
|
||||
<para>
|
||||
Attempts to allocate @n_structs elements of type @struct_type, and returns
|
||||
%NULL on failure. Contrast with g_new(), which aborts the program on failure.
|
||||
The returned pointer is cast to a pointer to the given type.
|
||||
If @n_structs is 0 it returns %NULL.
|
||||
</para>
|
||||
|
||||
@struct_type: the type of the elements to allocate.
|
||||
@n_structs: the number of elements to allocate.
|
||||
@Returns: a pointer to the allocated memory, cast to a pointer to @struct_type.
|
||||
@Since: 2.8
|
||||
|
||||
|
||||
<!-- ##### MACRO g_try_new0 ##### -->
|
||||
<para>
|
||||
Attempts to allocate @n_structs elements of type @struct_type, initialized
|
||||
to 0's, and returns %NULL on failure. Contrast with g_new0(), which aborts
|
||||
the program on failure.
|
||||
The returned pointer is cast to a pointer to the given type.
|
||||
If @n_counts is 0 it returns %NULL.
|
||||
</para>
|
||||
|
||||
@struct_type: the type of the elements to allocate.
|
||||
@n_structs: the number of elements to allocate.
|
||||
@Returns: a pointer to the allocated memory, cast to a pointer to @struct_type.
|
||||
@Since: 2.8
|
||||
|
||||
|
||||
<!-- ##### MACRO g_try_renew ##### -->
|
||||
<para>
|
||||
Attempts to reallocate the memory pointed to by @mem, so that it now has
|
||||
space for @n_structs elements of type @struct_type, and returns %NULL on
|
||||
failure. Contrast with g_renew(), which aborts the program on failure.
|
||||
It returns the new address of the memory, which may have been moved.
|
||||
</para>
|
||||
|
||||
@struct_type: the type of the elements to allocate.
|
||||
@mem: the currently allocated memory.
|
||||
@n_structs: the number of elements to allocate.
|
||||
@Returns: a pointer to the new allocated memory, cast to a pointer to @struct_type.
|
||||
@Since: 2.8
|
||||
|
||||
|
||||
<!-- ##### FUNCTION g_malloc ##### -->
|
||||
<para>
|
||||
Allocates @n_bytes bytes of memory.
|
||||
|
Reference in New Issue
Block a user