svn path=/trunk/; revision=5428
This commit is contained in:
Matthias Clasen 2007-03-19 03:47:05 +00:00
parent e51854dd5d
commit 46d22e511a
16 changed files with 91 additions and 93 deletions

View File

@ -1,3 +1,15 @@
2007-03-18 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/thread_pools.sgml:
* glib/tmpl/strings.sgml:
* glib/tmpl/string_chunks.sgml:
* glib/tmpl/spawn.sgml:
* glib/tmpl/patterns.sgml:
* glib/tmpl/modules.sgml:
* glib/tmpl/memory_slices.sgml:
* glib/tmpl/memory.sgml:
* glib/tmpl/gregex.sgml: Trivial cleanups
2007-03-16 Matthias Clasen <mclasen@redhat.com> 2007-03-16 Matthias Clasen <mclasen@redhat.com>
* === Released 2.13.0 === * === Released 2.13.0 ===

View File

@ -280,7 +280,7 @@ in any UNIX manual.
<!-- ##### MACRO ftruncate ##### --> <!-- ##### MACRO ftruncate ##### -->
<para> <para>
Provided for UNIX emulation on Windows; see documentation for <function>ftruncate()</function> Provided for UNIX emulation on Windows; see documentation for ftruncate()
in any UNIX manual. in any UNIX manual.
</para> </para>

View File

@ -80,8 +80,8 @@ written by Philip Hazel.
Error codes returned by regular expressions functions. Error codes returned by regular expressions functions.
</para> </para>
@G_REGEX_ERROR_COMPILE: Compilation of the regular expression in <function>g_regex_new()</function> failed. @G_REGEX_ERROR_COMPILE: Compilation of the regular expression in g_regex_new() failed.
@G_REGEX_ERROR_OPTIMIZE: Optimization of the regular expression in <function>g_regex_optimize()</function> failed. @G_REGEX_ERROR_OPTIMIZE: Optimization of the regular expression in g_regex_optimize() failed.
@G_REGEX_ERROR_REPLACE: Replacement failed due to an ill-formed replacement string. @G_REGEX_ERROR_REPLACE: Replacement failed due to an ill-formed replacement string.
@G_REGEX_ERROR_MATCH: The match process failed. @G_REGEX_ERROR_MATCH: The match process failed.
@Since: 2.14 @Since: 2.14

View File

@ -199,32 +199,32 @@ includes the key <link linkend="G_DEBUG">gc-friendly</link>.
<!-- ##### MACRO g_alloca ##### --> <!-- ##### MACRO g_alloca ##### -->
<para> <para>
Allocates @size bytes on the stack; these bytes will be freed when the current Allocates @size bytes on the stack; these bytes will be freed when the current
stack frame is cleaned up. This macro essentially just wraps the stack frame is cleaned up. This macro essentially just wraps the alloca()
<function>alloca()</function> function present on most UNIX variants. function present on most UNIX variants.
Thus it provides the same advantages and pitfalls as <function>alloca()</function>: Thus it provides the same advantages and pitfalls as alloca():
<variablelist> <variablelist>
<varlistentry><term></term><listitem><para> <varlistentry><term></term><listitem><para>
+ <function>alloca()</function> is very fast, as on most systems it's implemented by just adjusting + alloca() is very fast, as on most systems it's implemented by just adjusting
the stack pointer register. the stack pointer register.
</para></listitem></varlistentry> </para></listitem></varlistentry>
<varlistentry><term></term><listitem><para> <varlistentry><term></term><listitem><para>
+ It doesn't cause any memory fragmentation, within its scope, separate <function>alloca()</function> + It doesn't cause any memory fragmentation, within its scope, separate alloca()
blocks just build up and are released together at function end. blocks just build up and are released together at function end.
</para></listitem></varlistentry> </para></listitem></varlistentry>
<varlistentry><term></term><listitem><para> <varlistentry><term></term><listitem><para>
- Allocation sizes have to fit into the current stack frame. For instance in a - 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, threaded environment on Linux, the per-thread stack size is limited to 2 Megabytes,
so be sparse with <function>alloca()</function> uses. so be sparse with alloca() uses.
</para></listitem></varlistentry> </para></listitem></varlistentry>
<varlistentry><term></term><listitem><para> <varlistentry><term></term><listitem><para>
- Allocation failure due to insufficient stack space is not indicated with a %NULL - Allocation failure due to insufficient stack space is not indicated with a %NULL
return like e.g. with <function>malloc()</function>. Instead, most systems probably handle it the same return like e.g. with malloc(). Instead, most systems probably handle it the same
way as out of stack space situations from infinite function recursion, i.e. way as out of stack space situations from infinite function recursion, i.e.
with a segmentation fault. with a segmentation fault.
</para></listitem></varlistentry> </para></listitem></varlistentry>
<varlistentry><term></term><listitem><para> <varlistentry><term></term><listitem><para>
- Special care has to be taken when mixing <function>alloca()</function> with GNU C variable sized arrays. - Special care has to be taken when mixing alloca() with GNU C variable sized arrays.
Stack space allocated with <function>alloca()</function> in the same scope as a variable sized array Stack space allocated with alloca() in the same scope as a variable sized array
will be freed together with the variable sized array upon exit of that scope, and will be freed together with the variable sized array upon exit of that scope, and
not upon exit of the enclosing function scope. not upon exit of the enclosing function scope.
</para></listitem></varlistentry> </para></listitem></varlistentry>
@ -285,11 +285,12 @@ if it exists, should be prior to any use of GLib.
<!-- ##### FUNCTION g_mem_set_vtable ##### --> <!-- ##### FUNCTION g_mem_set_vtable ##### -->
<para> <para>
Sets the #GMemVTable to use for memory allocation. You can use this to provide Sets the #GMemVTable to use for memory allocation. You can use this to provide
custom memory allocation routines. <emphasis>This function must be called before using any other GLib functions.</emphasis> The @vtable only needs to provide <function>malloc()</function>, <function>realloc()</function>, and <function>free()</function> custom memory allocation routines. <emphasis>This function must be called
functions; GLib can provide default implementations of the others. The <function>malloc()</function> before using any other GLib functions.</emphasis> The @vtable only needs to
and <function>realloc()</function> implementations should return %NULL on failure, GLib will handle provide malloc(), realloc(), and free() functions; GLib can provide default
error-checking for you. @vtable is copied, so need not persist after this implementations of the others. The malloc() and realloc() implementations
function has been called. should return %NULL on failure, GLib will handle error-checking for you.
@vtable is copied, so need not persist after this function has been called.
</para> </para>
@vtable: table of memory allocation routines. @vtable: table of memory allocation routines.

View File

@ -96,7 +96,7 @@ object size used at allocation time is still available when freeing.
<para> <para>
Allocates a block of memory from the slice allocator. Allocates a block of memory from the slice allocator.
The block adress handed out is guaranteed to be aligned The block adress handed out is guaranteed to be aligned
to at least 2 * sizeof (void*). to at least <literal>2 * sizeof (void*)</literal>.
Note that the underlying slice allocation mechanism can Note that the underlying slice allocation mechanism can
be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link> be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
environment variable. environment variable.
@ -157,8 +157,9 @@ also see <link linkend="G_SLICE">G_SLICE</link> for related debugging options.
<!-- ##### MACRO g_slice_new ##### --> <!-- ##### MACRO g_slice_new ##### -->
<para> <para>
A convenience macro to allocate a block of memory from the slice allocator. A convenience macro to allocate a block of memory from the slice allocator.
It calls g_slice_alloc() with sizeof (@type) and casts the returned pointer It calls g_slice_alloc() with <literal>sizeof (@type)</literal> and casts
to a pointer of the given type, avoiding a type cast in the source code. the returned pointer to a pointer of the given type, avoiding a type cast
in the source code.
Note that the underlying slice allocation mechanism can Note that the underlying slice allocation mechanism can
be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link> be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
environment variable. environment variable.
@ -172,9 +173,9 @@ environment variable.
<!-- ##### MACRO g_slice_new0 ##### --> <!-- ##### MACRO g_slice_new0 ##### -->
<para> <para>
A convenience macro to allocate a block of memory from the slice allocator A convenience macro to allocate a block of memory from the slice allocator
and set the memory to 0. It calls g_slice_alloc0() with sizeof (@type) and and set the memory to 0. It calls g_slice_alloc0() with
casts the returned pointer to a pointer of the given type, avoiding a type <literal>sizeof (@type)</literal> and casts the returned pointer to a pointer
cast in the source code. of the given type, avoiding a type cast in the source code.
Note that the underlying slice allocation mechanism can Note that the underlying slice allocation mechanism can
be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link> be changed with the <link linkend="G_SLICE">G_SLICE=always-malloc</link>
environment variable. environment variable.

View File

@ -9,8 +9,8 @@ portable method for dynamically loading 'plug-ins'.
These functions provide a portable way to dynamically load object files These functions provide a portable way to dynamically load object files
(commonly known as 'plug-ins'). (commonly known as 'plug-ins').
The current implementation supports all systems that provide The current implementation supports all systems that provide
an implementation of <function>dlopen()</function> (e.g. Linux/Sun), as well as HP-UX via its an implementation of dlopen() (e.g. Linux/Sun), as well as HP-UX via its
<function>shl_load()</function> mechanism, and Windows platforms via DLLs. shl_load() mechanism, and Windows platforms via DLLs.
</para> </para>
<para> <para>

View File

@ -87,7 +87,7 @@ g_pattern_match().
Note also that the reverse of a UTF-8 encoded string can in general Note also that the reverse of a UTF-8 encoded string can in general
<emphasis>not</emphasis> be obtained by g_strreverse(). <emphasis>not</emphasis> be obtained by g_strreverse().
This works only if the string doesn't contain any multibyte characters. This works only if the string doesn't contain any multibyte characters.
Glib offers the g_utf_strreverse() function to reverse UTF-8 encoded strings. Glib offers the g_utf8_strreverse() function to reverse UTF-8 encoded strings.
</para> </para>
@pspec: a #GPatternSpec. @pspec: a #GPatternSpec.

View File

@ -2,7 +2,7 @@
Spawning Processes Spawning Processes
<!-- ##### SECTION Short_Description ##### --> <!-- ##### SECTION Short_Description ##### -->
process launching with <function>fork()</function>/<function>exec()</function>. process launching with fork()/exec().
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
@ -25,22 +25,22 @@ Error codes returned by spawning processes.
@G_SPAWN_ERROR_FORK: Fork failed due to lack of memory. @G_SPAWN_ERROR_FORK: Fork failed due to lack of memory.
@G_SPAWN_ERROR_READ: Read or select on pipes failed. @G_SPAWN_ERROR_READ: Read or select on pipes failed.
@G_SPAWN_ERROR_CHDIR: Changing to working directory failed. @G_SPAWN_ERROR_CHDIR: Changing to working directory failed.
@G_SPAWN_ERROR_ACCES: <function>execv()</function> returned %EACCES. @G_SPAWN_ERROR_ACCES: execv() returned %EACCES.
@G_SPAWN_ERROR_PERM: <function>execv()</function> returned %EPERM. @G_SPAWN_ERROR_PERM: execv() returned %EPERM.
@G_SPAWN_ERROR_2BIG: <function>execv()</function> returned %E2BIG. @G_SPAWN_ERROR_2BIG: execv() returned %E2BIG.
@G_SPAWN_ERROR_NOEXEC: <function>execv()</function> returned %ENOEXEC. @G_SPAWN_ERROR_NOEXEC: execv() returned %ENOEXEC.
@G_SPAWN_ERROR_NAMETOOLONG: <function>execv()</function> returned %ENAMETOOLONG. @G_SPAWN_ERROR_NAMETOOLONG: execv() returned %ENAMETOOLONG.
@G_SPAWN_ERROR_NOENT: <function>execv()</function> returned %ENOENT. @G_SPAWN_ERROR_NOENT: execv() returned %ENOENT.
@G_SPAWN_ERROR_NOMEM: <function>execv()</function> returned %ENOMEM. @G_SPAWN_ERROR_NOMEM: execv() returned %ENOMEM.
@G_SPAWN_ERROR_NOTDIR: <function>execv()</function> returned %ENOTDIR. @G_SPAWN_ERROR_NOTDIR: execv() returned %ENOTDIR.
@G_SPAWN_ERROR_LOOP: <function>execv()</function> returned %ELOOP. @G_SPAWN_ERROR_LOOP: execv() returned %ELOOP.
@G_SPAWN_ERROR_TXTBUSY: <function>execv()</function> returned %ETXTBUSY. @G_SPAWN_ERROR_TXTBUSY: execv() returned %ETXTBUSY.
@G_SPAWN_ERROR_IO: <function>execv()</function> returned %EIO. @G_SPAWN_ERROR_IO: execv() returned %EIO.
@G_SPAWN_ERROR_NFILE: <function>execv()</function> returned %ENFILE. @G_SPAWN_ERROR_NFILE: execv() returned %ENFILE.
@G_SPAWN_ERROR_MFILE: <function>execv()</function> returned %EMFILE. @G_SPAWN_ERROR_MFILE: execv() returned %EMFILE.
@G_SPAWN_ERROR_INVAL: <function>execv()</function> returned %EINVAL. @G_SPAWN_ERROR_INVAL: execv() returned %EINVAL.
@G_SPAWN_ERROR_ISDIR: <function>execv()</function> returned %EISDIR. @G_SPAWN_ERROR_ISDIR: execv() returned %EISDIR.
@G_SPAWN_ERROR_LIBBAD: <function>execv()</function> returned %ELIBBAD. @G_SPAWN_ERROR_LIBBAD: execv() returned %ELIBBAD.
@G_SPAWN_ERROR_FAILED: Some other fatal failure, <literal>error-&gt;message</literal> should explain. @G_SPAWN_ERROR_FAILED: Some other fatal failure, <literal>error-&gt;message</literal> should explain.
<!-- ##### MACRO G_SPAWN_ERROR ##### --> <!-- ##### MACRO G_SPAWN_ERROR ##### -->
@ -59,9 +59,9 @@ 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 @G_SPAWN_LEAVE_DESCRIPTORS_OPEN: the parent's open file descriptors will be
inherited by the child; otherwise all descriptors except stdin/stdout/stderr inherited by the child; otherwise all descriptors except stdin/stdout/stderr
will be closed before calling <function>exec()</function> 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 @G_SPAWN_DO_NOT_REAP_CHILD: the child will not be automatically reaped; you
must use g_child_watch_add() yourself (or call <function>waitpid()</function> must use g_child_watch_add() yourself (or call waitpid()
or handle <literal>SIGCHLD</literal> yourself), or the child will become a zombie. or handle <literal>SIGCHLD</literal> yourself), or the child will become a zombie.
@G_SPAWN_SEARCH_PATH: <literal>argv[0]</literal> need not be an absolute path, @G_SPAWN_SEARCH_PATH: <literal>argv[0]</literal> need not be an absolute path,
it will be looked for in the user's <envar>PATH</envar>. it will be looked for in the user's <envar>PATH</envar>.
@ -82,9 +82,8 @@ Flags passed to g_spawn_sync(), g_spawn_async() and g_spawn_async_with_pipes().
Specifies the type of the setup function passed to g_spawn_async(), Specifies the type of the setup function passed to g_spawn_async(),
g_spawn_sync() and g_spawn_async_with_pipes(). On POSIX platforms it g_spawn_sync() and g_spawn_async_with_pipes(). On POSIX platforms it
is called in the child after GLib has performed all the setup it plans is called in the child after GLib has performed all the setup it plans
to perform but before calling <function>exec()</function>. On POSIX to perform but before calling exec(). On POSIX actions taken in this
actions taken in this function will thus only affect the child, not function will thus only affect the child, not the parent.
the parent.
</para> </para>
<para> <para>

View File

@ -13,8 +13,8 @@ full a new block is allocated.
</para> </para>
<para> <para>
When storing a large number of strings, string chunks are more efficient When storing a large number of strings, string chunks are more efficient
than using g_strdup() since fewer calls to <function>malloc()</function> than using g_strdup() since fewer calls to malloc() are needed, and less
are needed, and less memory is wasted in memory allocation overheads. memory is wasted in memory allocation overheads.
</para> </para>
<para> <para>
By adding strings with g_string_chunk_insert_const() it is also possible By adding strings with g_string_chunk_insert_const() it is also possible
@ -127,6 +127,5 @@ After calling g_string_chunk_free() it is not safe to
access any of the strings which were contained within it. access any of the strings which were contained within it.
</para> </para>
@chunk: a #GStringChunk. @chunk: a #GStringChunk

View File

@ -303,7 +303,8 @@ returns the length of the allocated string.
<!-- ##### FUNCTION g_printf_string_upper_bound ##### --> <!-- ##### FUNCTION g_printf_string_upper_bound ##### -->
<para> <para>
Calculates the maximum space needed to store the output of the sprintf() function. Calculates the maximum space needed to store the output of the sprintf()
function.
</para> </para>
@format: the format string. See the printf() documentation. @format: the format string. See the printf() documentation.
@ -936,4 +937,3 @@ documentation.
If the signal is unknown, it returns "unknown signal (&lt;signum&gt;)". If the signal is unknown, it returns "unknown signal (&lt;signum&gt;)".
The string can only be used until the next call to g_strsignal(). The string can only be used until the next call to g_strsignal().

View File

@ -22,19 +22,12 @@ can be used for binary data with embedded nul bytes.
<!-- ##### STRUCT GString ##### --> <!-- ##### STRUCT GString ##### -->
<para> <para>
The #GString struct contains the public fields of a #GString. The #GString struct contains the public fields of a #GString.
The <structfield>str</structfield> field points to the character data.
It may move as text is added.
The <structfield>len</structfield> field contains the length of the string,
not including the terminating nul byte.
</para>
<para>
The <structfield>str</structfield> field is nul-terminated and so can be used as an ordinary C
string. But it may be moved when text is appended or inserted into the
string.
</para> </para>
@str: @str: points to the character data. It may move as text is added.
@len: The <structfield>str</structfield> field is nul-terminated and so
can be used as an ordinary C string.
@len: contains the length of the string, not including the terminating nul byte.
@allocated_len: @allocated_len:
<!-- ##### FUNCTION g_string_new ##### --> <!-- ##### FUNCTION g_string_new ##### -->
@ -309,8 +302,8 @@ Compares two strings for equality, returning %TRUE if they are equal.
For use with #GHashTable. For use with #GHashTable.
</para> </para>
@v: a #GString. @v: a #GString
@v2: another #GString. @v2: another #GString
@Returns: %TRUE if they strings are the same length and contain the same bytes. @Returns: %TRUE if they strings are the same length and contain the same bytes.

View File

@ -6,9 +6,9 @@ pools of threads to execute work concurrently.
<!-- ##### SECTION Long_Description ##### --> <!-- ##### SECTION Long_Description ##### -->
<para> <para>
Sometimes you wish to asyncronously fork out the execution of work and Sometimes you wish to asynchronously fork out the execution of work and
continue working in your own thread. If that will happen often, the continue working in your own thread. If that will happen often, the
overhead of starting and destroying a thread each time might be to overhead of starting and destroying a thread each time might be too
high. In such cases reusing already started threads seems like a good high. In such cases reusing already started threads seems like a good
idea. And it indeed is, but implementing this can be tedious and idea. And it indeed is, but implementing this can be tedious and
error-prone. error-prone.

View File

@ -960,7 +960,7 @@ functions increases the depth of @mutex and returns immediately.
Tries to lock @mutex. If @mutex is already locked by another thread, Tries to lock @mutex. If @mutex is already locked by another thread,
it immediately returns %FALSE. Otherwise it locks @mutex and returns it immediately returns %FALSE. Otherwise it locks @mutex and returns
%TRUE. If @mutex is already locked by the calling thread, this %TRUE. If @mutex is already locked by the calling thread, this
functions increases the depth of @mutex and immediately returns %TRUE. functions increases the depth of @mutex and immediately returns %TRUE.
</para> </para>
@mutex: a #GStaticRecMutex to lock. @mutex: a #GStaticRecMutex to lock.
@ -1425,7 +1425,7 @@ done as follows:
if (!current_number) if (!current_number)
{ {
current_number = g_new (int,1); current_number = g_new (int, 1);
*current_number = 0; *current_number = 0;
g_private_set (current_number_key, current_number); g_private_set (current_number_key, current_number);
} }

View File

@ -56,22 +56,18 @@ g_node_destroy().
<para> <para>
The <structname>GNode</structname> struct represents one node in a The <structname>GNode</structname> struct represents one node in a
<link linkend="glib-N-ary-Trees">N-ary Tree</link>. <link linkend="glib-N-ary-Trees">N-ary Tree</link>.
The <structfield>data</structfield> field contains the actual data of the node. fields
The <structfield>next</structfield> and <structfield>prev</structfield>
fields point to the node's siblings (a sibling is another <structname>GNode</structname> with the
same parent).
The <structfield>parent</structfield> field points to the parent of the <structname>GNode</structname>,
or is %NULL if the <structname>GNode</structname> is the root of the tree.
The <structfield>children</structfield> field points to the first child of the
<structname>GNode</structname>. The other children are accessed by using the
<structfield>next</structfield> pointer of each child.
</para> </para>
@data: @data: contains the actual data of the node.
@next: @next: points to the node's next sibling (a sibling is another
@prev: <structname>GNode</structname> with the same parent).
@parent: @prev: points to the node's previous sibling.
@children: @parent: points to the parent of the <structname>GNode</structname>,
or is %NULL if the <structname>GNode</structname> is the root of the tree.
@children: The <structfield>children</structfield> field points to the first
child of the <structname>GNode</structname>. The other children are accessed
by using the <structfield>next</structfield> pointer of each child.
<!-- ##### FUNCTION g_node_new ##### --> <!-- ##### FUNCTION g_node_new ##### -->
<para> <para>

View File

@ -30,8 +30,7 @@ Instead, libraries should use g_log(), or the convenience functions
g_message(), g_warning() and g_error(). g_message(), g_warning() and g_error().
</para> </para>
@format: the message format. See the <function>printf()</function> @format: the message format. See the printf() documentation.
documentation.
@Varargs: the parameters to insert into the format string. @Varargs: the parameters to insert into the format string.
@ -67,8 +66,7 @@ g_printerr() should not be used from within libraries. Instead g_log() should
be used, or the convenience functions g_message(), g_warning() and g_error(). be used, or the convenience functions g_message(), g_warning() and g_error().
</para> </para>
@format: the message format. See the <function>printf()</function> @format: the message format. See the printf() documentation.
documentation.
@Varargs: the parameters to insert into the format string. @Varargs: the parameters to insert into the format string.

View File

@ -30,7 +30,7 @@ macro %MAXPATHLEN, which is the maximum length of a filename
<!-- ##### MACRO pipe ##### --> <!-- ##### MACRO pipe ##### -->
<para> <para>
Provided for UNIX emulation on Windows; see documentation for <function>pipe()</function> Provided for UNIX emulation on Windows; see documentation for pipe()
in any UNIX manual. in any UNIX manual.
</para> </para>
@ -94,9 +94,8 @@ in any UNIX manual.
<!-- ##### MACRO G_WIN32_DLLMAIN_FOR_DLL_NAME ##### --> <!-- ##### MACRO G_WIN32_DLLMAIN_FOR_DLL_NAME ##### -->
<para> <para>
On Windows, this macro defines a <function>DllMain()</function> function On Windows, this macro defines a DllMain() function that stores the actual
that stores the actual DLL name that the code being compiled will be DLL name that the code being compiled will be included in.
included in.
</para> </para>
<para> <para>
On non-Windows platforms, expands to nothing. On non-Windows platforms, expands to nothing.