Fixed documentation to work with Gtk-Doc 1.14 and produce as few warnings as possible
[rodin/chimara.git] / libchimara / stream.c
index a7f991d9f0805b370300c727ee859fcc10ad9bda..3c15127211dcf00e5667637299bcdc9039c6f847 100644 (file)
@@ -24,29 +24,16 @@ stream_new_common(glui32 rock)
        /* Add it to the global stream list */
        glk_data->stream_list = g_list_prepend(glk_data->stream_list, str);
        str->stream_list = glk_data->stream_list;
-       
+
        return str;
 }
 
-/* Internal function: Stuff to do upon closing any type of stream. */
+/* Internal function: Stuff to do upon closing any type of stream. Call only 
+ from Glk thread. */
 void
 stream_close_common(strid_t str, stream_result_t *result)
 {
        ChimaraGlkPrivate *glk_data = g_private_get(glk_data_key);
-       
-       /* Remove the stream from the global stream list */
-       glk_data->stream_list = g_list_delete_link(glk_data->stream_list, str->stream_list);
-       
-       /* If it was the current output stream, set that to NULL */
-       if(glk_data->current_stream == str)
-               glk_data->current_stream = NULL;
-               
-       /* If it was one or more windows' echo streams, set those to NULL */
-       winid_t win;
-       for(win = glk_window_iterate(NULL, NULL); win; 
-               win = glk_window_iterate(win, NULL))
-               if(win->echo_stream == str)
-                       win->echo_stream = NULL;
 
        if(glk_data->unregister_obj)
        {
@@ -54,12 +41,26 @@ stream_close_common(strid_t str, stream_result_t *result)
                str->disprock.ptr = NULL;
        }
        
+       /* If the stream was one or more windows' echo streams, set those to NULL */
+       winid_t win;
+       for(win = glk_window_iterate(NULL, NULL); win; 
+               win = glk_window_iterate(win, NULL))
+               if(win->echo_stream == str)
+                       win->echo_stream = NULL;
+       
        /* Return the character counts */
        if(result) 
        {
                result->readcount = str->read_count;
                result->writecount = str->write_count;
        }
+
+       /* Remove the stream from the global stream list */
+       glk_data->stream_list = g_list_delete_link(glk_data->stream_list, str->stream_list);
+       
+       /* If it was the current output stream, set that to NULL */
+       if(glk_data->current_stream == str)
+               glk_data->current_stream = NULL;
        
        str->magic = MAGIC_FREE;
        g_free(str);
@@ -191,7 +192,7 @@ glk_put_char_uni(glui32 ch)
  * equivalent to
  * |[
  * for (ptr = s; *ptr; ptr++)
- *     #glk_put_char(*ptr);
+ *     glk_put_char(*ptr);
  * ]|
  * However, it may be more efficient.
  */
@@ -228,7 +229,7 @@ glk_put_string_uni(glui32 *s)
  * to:
  * |[
  * for (i = 0; i < len; i++)
- *     #glk_put_char(buf[i]);
+ *     glk_put_char(buf[i]);
  * ]|
  * However, it may be more efficient.
  */