diff --git a/ChangeLog b/ChangeLog index cc85f5d43..47c00a910 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index cc85f5d43..47c00a910 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cc85f5d43..47c00a910 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index cc85f5d43..47c00a910 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index cc85f5d43..47c00a910 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index cc85f5d43..47c00a910 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index cc85f5d43..47c00a910 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index cc85f5d43..47c00a910 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,8 @@ +Wed Nov 14 07:34:24 2001 Tim Janik + + * glib/galloca.h (g_newa): provide g_newa(ctype, count) on top of + g_alloca() like we provide g_new() on top of g_malloc(). + Tue Nov 13 21:25:35 2001 Owen Taylor * glib/{gen-unicode-tables.pl,gunibreak.c,gunibreak.h, diff --git a/Makefile.am b/Makefile.am index bd402b752..31c8d69c9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = 1.4 -SUBDIRS = . m4macros glib gobject gmodule gthread docs tests build po +SUBDIRS = . m4macros glib gobject gmodule gthread tests build po docs bin_SCRIPTS = glib-gettextize diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index 34d511207..55c099605 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -697,6 +697,7 @@ g_free g_alloca +g_newa g_memmove diff --git a/docs/reference/glib/tmpl/memory.sgml b/docs/reference/glib/tmpl/memory.sgml index ee61d661c..b20aa3f82 100644 --- a/docs/reference/glib/tmpl/memory.sgml +++ b/docs/reference/glib/tmpl/memory.sgml @@ -124,10 +124,51 @@ If @mem is %NULL it simply returns. Allocates @size bytes on the stack; these bytes will be freed when the current -stack frame is cleaned up. +stack frame is cleaned up. This macro essentially just wraps the alloca(3) function +present on most unix variants. Thus it provides the same advantages and pitfalls +as alloca(): + + + + alloca() is very fast, as on most systems it's implemented by just adjusting + the stack pointer register. + + + + It doesn't cause any memory fragmentation, within its scope, seperate alloca() + blocks just build up and are released together at function end. + + + - Allocation sizes have to fit into the current stack frame. For instance in a + threaded environment on Linux, the per-thread stack size is limited to 2 Megabytes, + so be sparse with alloca() uses. + + + - Allocation failure due to insufficient stack space is not indicated with a %NULL + return like e.g. with malloc(3). Instead, most systems probably handle it the same + way as out of stack space situations from infinite function recursion, i.e. + with a segmentation fault. + + + - Special care has to be taken when mixing alloca(3) with GCC variable sized arrays. + Stack space allocated with alloca(3) in the same scope as a variable 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. + + + -@size: number of bytes to allocate. +@size: number of bytes to allocate. +@Returns: space for @size bytes, allocated on the stack + + + + +Wraps g_alloca() in a more typesafe manner. + + +@struct_type: Type of memory chunks to be allocated +@n_structs: Number of chunks to be allocated +@Returns: Pointer to stack space for @n_structs chunks of type @struct_type diff --git a/docs/reference/glib/tmpl/spawn.sgml b/docs/reference/glib/tmpl/spawn.sgml index 633a93ba2..9426a77c1 100644 --- a/docs/reference/glib/tmpl/spawn.sgml +++ b/docs/reference/glib/tmpl/spawn.sgml @@ -56,7 +56,7 @@ Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes(). @G_SPAWN_LEAVE_DESCRIPTORS_OPEN: the parent's open file descriptors will be inherited by the child; otherwise all descriptors except stdin/stdout/stderr - will be closed before calling exec() in the child. + will be closed before calling exec() in the child. @G_SPAWN_DO_NOT_REAP_CHILD: the child will not be automatically reaped; you must call waitpid() or handle SIGCHLD yourself, or the child will become a zombie. diff --git a/docs/reference/glib/tmpl/unicode.sgml b/docs/reference/glib/tmpl/unicode.sgml index fabf29d51..1bab83664 100644 --- a/docs/reference/glib/tmpl/unicode.sgml +++ b/docs/reference/glib/tmpl/unicode.sgml @@ -518,20 +518,20 @@ character. Unicode strings should generally be normalized before comparing them. @G_NORMALIZE_DEFAULT: standardize differences that do not affect the - text content, such as the above-mentioned accent representation. -@G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT. + text content, such as the above-mentioned accent representation. +@G_NORMALIZE_NFD: another name for %G_NORMALIZE_DEFAULT. @G_NORMALIZE_DEFAULT_COMPOSE: like %G_NORMALIZE_DEFAULT, but with composed - forms rather than a maximally decomposed form. + forms rather than a maximally decomposed form. @G_NORMALIZE_NFC: another name for %G_NORMALIZE_DEFAULT_COMPOSE. @G_NORMALIZE_ALL: beyond %G_NORMALIZE_DEFAULT also standardize the "compatibility" characters in Unicode, such as SUPERSCRIPT THREE to the standard forms (in this case DIGIT THREE). Formatting information may be lost but for most text operations such characters should be considered the - same. -@G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL. + same. +@G_NORMALIZE_NFKD: another name for %G_NORMALIZE_ALL. @G_NORMALIZE_ALL_COMPOSE: like %G_NORMALIZE_ALL, but with composed - forms rather than a maximally decomposed form. -@G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE. + forms rather than a maximally decomposed form. +@G_NORMALIZE_NFKC: another name for %G_NORMALIZE_ALL_COMPOSE. diff --git a/glib/galloca.h b/glib/galloca.h index 7bc0a5fa3..571ab7672 100644 --- a/glib/galloca.h +++ b/glib/galloca.h @@ -53,8 +53,8 @@ G_END_DECLS # endif /* !_MSC_VER */ #endif /* !__GNUC__ && !GLIB_HAVE_ALLOCA_H */ -#define g_alloca(size) alloca (size) +#define g_alloca(size) alloca (size) +#define g_newa(struct_type, n_structs) ((struct_type*) g_alloca (sizeof (struct_type) * (gsize) (n_structs))) #endif /* __G_ALLOCA_H__ */ -