galloca.h   galloca.h 
skipping to change at line 60 skipping to change at line 60
# else /* !_AIX */ # else /* !_AIX */
# ifndef alloca /* predefined by HP cc +Olibcalls */ # ifndef alloca /* predefined by HP cc +Olibcalls */
G_BEGIN_DECLS G_BEGIN_DECLS
char *alloca (); char *alloca ();
G_END_DECLS G_END_DECLS
# endif /* !alloca */ # endif /* !alloca */
# endif /* !_AIX */ # endif /* !_AIX */
# endif /* !_MSC_VER && !__DMC__ */ # endif /* !_MSC_VER && !__DMC__ */
#endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ #endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */
/**
* g_alloca:
* @size: number of bytes to allocate.
*
* Allocates @size bytes on the stack; these bytes will be freed when the c
urrent
* stack frame is cleaned up. This macro essentially just wraps the alloca(
)
* function present on most UNIX variants.
* Thus it provides the same advantages and pitfalls as alloca():
* <variablelist>
* <varlistentry><term></term><listitem><para>
* + alloca() is very fast, as on most systems it's implemented by just
adjusting
* the stack pointer register.
* </para></listitem></varlistentry>
* <varlistentry><term></term><listitem><para>
* + It doesn't cause any memory fragmentation, within its scope, separ
ate alloca()
* blocks just build up and are released together at function end.
* </para></listitem></varlistentry>
* <varlistentry><term></term><listitem><para>
* - Allocation sizes have to fit into the current stack frame. For ins
tance in a
* threaded environment on Linux, the per-thread stack size is limite
d to 2 Megabytes,
* so be sparse with alloca() uses.
* </para></listitem></varlistentry>
* <varlistentry><term></term><listitem><para>
* - Allocation failure due to insufficient stack space is not indicate
d with a %NULL
* return like e.g. with malloc(). Instead, most systems probably han
dle it the same
* way as out of stack space situations from infinite function recurs
ion, i.e.
* with a segmentation fault.
* </para></listitem></varlistentry>
* <varlistentry><term></term><listitem><para>
* - Special care has to be taken when mixing alloca() with GNU C varia
ble sized arrays.
* Stack space allocated with alloca() in the same scope as a variabl
e sized array
* will be freed together with the variable sized array upon exit of
that scope, and
* not upon exit of the enclosing function scope.
* </para></listitem></varlistentry>
* </variablelist>
*
* Returns: space for @size bytes, allocated on the stack
*/
#define g_alloca(size) alloca (size) #define g_alloca(size) alloca (size)
/**
* g_newa:
* @struct_type: Type of memory chunks to be allocated
* @n_structs: Number of chunks to be allocated
*
* Wraps g_alloca() in a more typesafe manner.
*
* Returns: Pointer to stack space for @n_structs chunks of type @struct_ty
pe
*/
#define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (st ruct_type) * (gsize) (n_structs))) #define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (st ruct_type) * (gsize) (n_structs)))
#endif /* __G_ALLOCA_H__ */ #endif /* __G_ALLOCA_H__ */
 End of changes. 2 change blocks. 
0 lines changed or deleted 60 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/