X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=libchimara%2Fstream.c;h=3c15127211dcf00e5667637299bcdc9039c6f847;hb=c0a115ac5ebe3104dc1186dda3f798784db3c469;hp=f6abec64885e4718783485df6a72e14efd9d185d;hpb=cbd4cb7f8c62b2ba51329a4cb082a96115a7529d;p=rodin%2Fchimara.git diff --git a/libchimara/stream.c b/libchimara/stream.c index f6abec6..3c15127 100644 --- a/libchimara/stream.c +++ b/libchimara/stream.c @@ -24,24 +24,8 @@ 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: stream closing stuff that is safe to call from either the - main thread or the Glk thread. */ -void -trash_stream_thread_independent(ChimaraGlkPrivate *glk_data, strid_t str) -{ - /* 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); + return str; } /* Internal function: Stuff to do upon closing any type of stream. Call only @@ -71,7 +55,15 @@ stream_close_common(strid_t str, stream_result_t *result) result->writecount = str->write_count; } - trash_stream_thread_independent(glk_data, str); + /* 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); } /** @@ -200,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. */ @@ -237,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. */