mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-05-18 03:31:57 +02:00
s/<!>/<!-- -->/g throughout the documentation to bring the produced
* glib/tmpl/error_reporting.sgml: * glib/tmpl/threads.sgml: * glib/tmpl/arrays_pointer.sgml: * glib/tmpl/arrays_byte.sgml: * glib/tmpl/memory_chunks.sgml: s/<!>/<!-- -->/g throughout the documentation to bring the produced Docbook closer to XML.
This commit is contained in:
parent
3e22c9e449
commit
5cbcd52547
@ -1,3 +1,12 @@
|
||||
2002-04-18 Matthias Clasen <maclas@gmx.de>
|
||||
|
||||
* glib/tmpl/error_reporting.sgml:
|
||||
* glib/tmpl/threads.sgml:
|
||||
* glib/tmpl/arrays_pointer.sgml:
|
||||
* glib/tmpl/arrays_byte.sgml:
|
||||
* glib/tmpl/memory_chunks.sgml: s/<!>/<!-- -->/g throughout the
|
||||
documentation to bring the produced Docbook closer to XML.
|
||||
|
||||
2002-03-25 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* glib/tmpl/scanner.sgml: Fixed documentation about unused struct
|
||||
|
@ -29,7 +29,7 @@ To free a #GByteArray, use g_byte_array_free().
|
||||
GByteArray *gbarray;
|
||||
gint i;
|
||||
|
||||
gbarray = g_byte_array_new (<!>);
|
||||
gbarray = g_byte_array_new (<!-- -->);
|
||||
for (i = 0; i < 10000; i++)
|
||||
g_byte_array_append (gbarray, (guint8*) "abcd", 4);
|
||||
|
||||
|
@ -43,7 +43,7 @@ To free a pointer array, use g_ptr_array_free().
|
||||
GPtrArray *gparray;
|
||||
gchar *string1 = "one", *string2 = "two", *string3 = "three";
|
||||
|
||||
gparray = g_ptr_array_new (<!>);
|
||||
gparray = g_ptr_array_new (<!-- -->);
|
||||
g_ptr_array_add (gparray, (gpointer) string1);
|
||||
g_ptr_array_add (gparray, (gpointer) string2);
|
||||
g_ptr_array_add (gparray, (gpointer) string3);
|
||||
|
@ -167,7 +167,7 @@ my_function_that_can_fail (GError **err)
|
||||
if (tmp_error != NULL)
|
||||
{
|
||||
/* store tmp_error in err, if err != NULL,
|
||||
* otherwise call g_error_free(<!>) on tmp_error
|
||||
* otherwise call g_error_free(<!-- -->) on tmp_error
|
||||
*/
|
||||
g_propagate_error (err, tmp_error);
|
||||
return FALSE;
|
||||
|
@ -95,11 +95,11 @@ To help debug memory chunks, use g_mem_chunk_info() and g_mem_chunk_print().
|
||||
GRealArray *array;
|
||||
|
||||
/* Create a GMemChunk to hold GRealArray structures, using the
|
||||
g_mem_chunk_create(<!>) convenience macro. We want 1024 atoms in each
|
||||
g_mem_chunk_create(<!-- -->) convenience macro. We want 1024 atoms in each
|
||||
memory block, and we want to be able to free individual atoms. */
|
||||
array_mem_chunk = g_mem_chunk_create (GRealArray, 1024, G_ALLOC_AND_FREE);
|
||||
|
||||
/* Allocate one atom, using the g_chunk_new(<!>) convenience macro. */
|
||||
/* Allocate one atom, using the g_chunk_new(<!-- -->) convenience macro. */
|
||||
array = g_chunk_new (GRealArray, array_mem_chunk);
|
||||
|
||||
/* We can now use array just like a normal pointer to a structure. */
|
||||
|
@ -172,7 +172,7 @@ system is initialized, you can do that too:
|
||||
<para>
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
if (!g_thread_supported (<!>)) g_thread_init (NULL);
|
||||
if (!g_thread_supported (<!-- -->)) g_thread_init (NULL);
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
</para>
|
||||
@ -458,7 +458,7 @@ access. Take for example the following function:
|
||||
<example>
|
||||
<title>A function which will not work in a threaded environment</title>
|
||||
<programlisting>
|
||||
int give_me_next_number (<!>)
|
||||
int give_me_next_number (<!-- -->)
|
||||
{
|
||||
static int current_number = 0;
|
||||
|
||||
@ -481,7 +481,7 @@ access. A first naive implementation would be:
|
||||
<example>
|
||||
<title>The wrong way to write a thread-safe function</title>
|
||||
<programlisting>
|
||||
int give_me_next_number (<!>)
|
||||
int give_me_next_number (<!-- -->)
|
||||
{
|
||||
static int current_number = 0;
|
||||
int ret_val;
|
||||
@ -510,15 +510,15 @@ not use such constructs in your own programs. One working solution is:
|
||||
<programlisting>
|
||||
static GMutex *give_me_next_number_mutex = NULL;
|
||||
|
||||
/* this function must be called before any call to give_me_next_number (<!>)
|
||||
/* this function must be called before any call to give_me_next_number (<!-- -->)
|
||||
it must be called exactly once. */
|
||||
void init_give_me_next_number (<!>)
|
||||
void init_give_me_next_number (<!-- -->)
|
||||
{
|
||||
g_assert (give_me_next_number_mutex == NULL);
|
||||
give_me_next_number_mutex = g_mutex_new (<!>);
|
||||
give_me_next_number_mutex = g_mutex_new (<!-- -->);
|
||||
}
|
||||
|
||||
int give_me_next_number (<!>)
|
||||
int give_me_next_number (<!-- -->)
|
||||
{
|
||||
static int current_number = 0;
|
||||
int ret_val;
|
||||
@ -656,7 +656,7 @@ safer version of our <function>give_me_next_number()</function> example:
|
||||
<example>
|
||||
<title>Using <structname>GStaticMutex</structname> to simplify thread-safe programming</title>
|
||||
<programlisting>
|
||||
int give_me_next_number (<!>)
|
||||
int give_me_next_number (<!-- -->)
|
||||
{
|
||||
static int current_number = 0;
|
||||
int ret_val;
|
||||
@ -805,7 +805,7 @@ variable you intent to protect with the lock. Look at our
|
||||
<programlisting>
|
||||
G_LOCK_DEFINE (current_number);
|
||||
|
||||
int give_me_next_number (<!>)
|
||||
int give_me_next_number (<!-- -->)
|
||||
{
|
||||
static int current_number = 0;
|
||||
int ret_val;
|
||||
@ -1033,7 +1033,7 @@ example:
|
||||
g_static_rw_lock_writer_lock (&rwlock);
|
||||
|
||||
if (!array)
|
||||
array = g_ptr_array_new ();
|
||||
array = g_ptr_array_new (<!-- -->);
|
||||
|
||||
if (index >= array->len)
|
||||
g_ptr_array_set_size (array, index+1);
|
||||
@ -1245,7 +1245,7 @@ void push_data (gpointer data)
|
||||
g_mutex_unlock (data_mutex);
|
||||
}
|
||||
|
||||
gpointer pop_data ()
|
||||
gpointer pop_data (<!-- -->)
|
||||
{
|
||||
gpointer data;
|
||||
|
||||
@ -1402,7 +1402,7 @@ done as follows:
|
||||
GPrivate* current_number_key = NULL; /* Must be initialized somewhere */
|
||||
/* with g_private_new (g_free); */
|
||||
|
||||
int give_me_next_number ()
|
||||
int give_me_next_number (<!-- -->)
|
||||
{
|
||||
int *current_number = g_private_get (current_number_key);
|
||||
|
||||
@ -1519,7 +1519,7 @@ the difference between #GMutex and #GStaticMutex. Now look at our
|
||||
<example>
|
||||
<title>Using GStaticPrivate for per-thread data</title>
|
||||
<programlisting>
|
||||
int give_me_next_number ()
|
||||
int give_me_next_number (<!-- -->)
|
||||
{
|
||||
static GStaticPrivate current_number_key = G_STATIC_PRIVATE_INIT;
|
||||
int *current_number = g_static_private_get (&current_number_key);
|
||||
|
Loading…
x
Reference in New Issue
Block a user