From 5cbcd52547da636d312e742e35bab655f424cce0 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 18 Apr 2002 22:03:38 +0000 Subject: [PATCH] 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. --- docs/reference/ChangeLog | 9 +++++++++ docs/reference/glib/tmpl/arrays_byte.sgml | 2 +- docs/reference/glib/tmpl/arrays_pointer.sgml | 2 +- docs/reference/glib/tmpl/error_reporting.sgml | 2 +- docs/reference/glib/tmpl/memory_chunks.sgml | 4 ++-- docs/reference/glib/tmpl/threads.sgml | 26 +++++++++++++------------- 6 files changed, 27 insertions(+), 18 deletions(-) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 1a76567..8546e1d 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,12 @@ +2002-04-18 Matthias Clasen + + * 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 * glib/tmpl/scanner.sgml: Fixed documentation about unused struct diff --git a/docs/reference/glib/tmpl/arrays_byte.sgml b/docs/reference/glib/tmpl/arrays_byte.sgml index e59af2d..5a0c764 100644 --- a/docs/reference/glib/tmpl/arrays_byte.sgml +++ b/docs/reference/glib/tmpl/arrays_byte.sgml @@ -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); diff --git a/docs/reference/glib/tmpl/arrays_pointer.sgml b/docs/reference/glib/tmpl/arrays_pointer.sgml index 48f869b..889628b 100644 --- a/docs/reference/glib/tmpl/arrays_pointer.sgml +++ b/docs/reference/glib/tmpl/arrays_pointer.sgml @@ -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); diff --git a/docs/reference/glib/tmpl/error_reporting.sgml b/docs/reference/glib/tmpl/error_reporting.sgml index 336dee6..f3e2971 100644 --- a/docs/reference/glib/tmpl/error_reporting.sgml +++ b/docs/reference/glib/tmpl/error_reporting.sgml @@ -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; diff --git a/docs/reference/glib/tmpl/memory_chunks.sgml b/docs/reference/glib/tmpl/memory_chunks.sgml index ad44e21..1cddb70 100644 --- a/docs/reference/glib/tmpl/memory_chunks.sgml +++ b/docs/reference/glib/tmpl/memory_chunks.sgml @@ -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. */ diff --git a/docs/reference/glib/tmpl/threads.sgml b/docs/reference/glib/tmpl/threads.sgml index 76ac5c2..e0dca74 100644 --- a/docs/reference/glib/tmpl/threads.sgml +++ b/docs/reference/glib/tmpl/threads.sgml @@ -172,7 +172,7 @@ system is initialized, you can do that too: -if (!g_thread_supported ()) g_thread_init (NULL); +if (!g_thread_supported ()) g_thread_init (NULL); @@ -458,7 +458,7 @@ access. Take for example the following function: A function which will not work in a threaded environment - 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: The wrong way to write a thread-safe function - 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: 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 give_me_next_number() example: Using <structname>GStaticMutex</structname> to simplify thread-safe programming - 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 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 Using GStaticPrivate for per-thread data - 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); -- 2.7.4