From c83e52605f373aeae29f02361d51af3799e6dae2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 8 Nov 2004 18:26:56 +0000 Subject: [PATCH] Make g_io_channel_ref(), g_main_context_ref(), g_hook_ref(), 2004-11-08 Matthias Clasen * glib/gasyncqueue.[hc]: * glib/ghook.[hc]: * glib/gmain.[hc]: * glib/giochannel.[hc]: Make g_io_channel_ref(), g_main_context_ref(), g_hook_ref(), g_async_queue_ref() return the passed in pointer. (#151663, Manish Singh) --- ChangeLog | 9 ++++++++- ChangeLog.pre-2-10 | 9 ++++++++- ChangeLog.pre-2-12 | 9 ++++++++- ChangeLog.pre-2-6 | 9 ++++++++- ChangeLog.pre-2-8 | 9 ++++++++- docs/reference/ChangeLog | 5 +++++ docs/reference/glib/tmpl/hooks.sgml | 2 +- docs/reference/glib/tmpl/iochannels.sgml | 2 +- glib/gasyncqueue.c | 6 +++++- glib/gasyncqueue.h | 2 +- glib/ghook.c | 4 +++- glib/ghook.h | 2 +- glib/giochannel.c | 4 +++- glib/giochannel.h | 2 +- glib/gmain.c | 4 +++- glib/gmain.h | 2 +- 16 files changed, 65 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07ce92a54..4adb44286 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2004-11-08 Matthias Clasen - + + * glib/gasyncqueue.[hc]: + * glib/ghook.[hc]: + * glib/gmain.[hc]: + * glib/giochannel.[hc]: Make g_io_channel_ref(), + g_main_context_ref(), g_hook_ref(), g_async_queue_ref() + return the passed in pointer. (#151663, Manish Singh) + * glib/gmain.c: Initialize child_watch_count to 1, so that we don't miss the very first child if it exits before we set up the child watch. In that case we had diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 07ce92a54..4adb44286 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,12 @@ 2004-11-08 Matthias Clasen - + + * glib/gasyncqueue.[hc]: + * glib/ghook.[hc]: + * glib/gmain.[hc]: + * glib/giochannel.[hc]: Make g_io_channel_ref(), + g_main_context_ref(), g_hook_ref(), g_async_queue_ref() + return the passed in pointer. (#151663, Manish Singh) + * glib/gmain.c: Initialize child_watch_count to 1, so that we don't miss the very first child if it exits before we set up the child watch. In that case we had diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 07ce92a54..4adb44286 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,12 @@ 2004-11-08 Matthias Clasen - + + * glib/gasyncqueue.[hc]: + * glib/ghook.[hc]: + * glib/gmain.[hc]: + * glib/giochannel.[hc]: Make g_io_channel_ref(), + g_main_context_ref(), g_hook_ref(), g_async_queue_ref() + return the passed in pointer. (#151663, Manish Singh) + * glib/gmain.c: Initialize child_watch_count to 1, so that we don't miss the very first child if it exits before we set up the child watch. In that case we had diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 07ce92a54..4adb44286 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,12 @@ 2004-11-08 Matthias Clasen - + + * glib/gasyncqueue.[hc]: + * glib/ghook.[hc]: + * glib/gmain.[hc]: + * glib/giochannel.[hc]: Make g_io_channel_ref(), + g_main_context_ref(), g_hook_ref(), g_async_queue_ref() + return the passed in pointer. (#151663, Manish Singh) + * glib/gmain.c: Initialize child_watch_count to 1, so that we don't miss the very first child if it exits before we set up the child watch. In that case we had diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 07ce92a54..4adb44286 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,12 @@ 2004-11-08 Matthias Clasen - + + * glib/gasyncqueue.[hc]: + * glib/ghook.[hc]: + * glib/gmain.[hc]: + * glib/giochannel.[hc]: Make g_io_channel_ref(), + g_main_context_ref(), g_hook_ref(), g_async_queue_ref() + return the passed in pointer. (#151663, Manish Singh) + * glib/gmain.c: Initialize child_watch_count to 1, so that we don't miss the very first child if it exits before we set up the child watch. In that case we had diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 851f2fd0f..7387a890e 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,8 @@ +2004-11-08 Matthias Clasen + + * glib/tmpl/hooks.sgml: + * glib/tmpl/iochannels.sgml: Updates + 2004-11-04 Tor Lillqvist * glib/tmpl/windows.sgml: Improve G_WIN32_HAVE_WIDECHAR_API diff --git a/docs/reference/glib/tmpl/hooks.sgml b/docs/reference/glib/tmpl/hooks.sgml index 677bf5ae2..842d4e803 100644 --- a/docs/reference/glib/tmpl/hooks.sgml +++ b/docs/reference/glib/tmpl/hooks.sgml @@ -417,7 +417,7 @@ Increments the reference count for a #GHook. @hook_list: a #GHookList. @hook: the #GHook to increment the reference count of. - +@returns: the @hook that was passed in (since 2.6) diff --git a/docs/reference/glib/tmpl/iochannels.sgml b/docs/reference/glib/tmpl/iochannels.sgml index 9445bfd21..443da42fa 100644 --- a/docs/reference/glib/tmpl/iochannels.sgml +++ b/docs/reference/glib/tmpl/iochannels.sgml @@ -301,7 +301,7 @@ Increments the reference count of a #GIOChannel. @channel: a #GIOChannel. - +@Returns: the @channel that was passed in (since 2.6) diff --git a/glib/gasyncqueue.c b/glib/gasyncqueue.c index c2e941d67..6822f7dee 100644 --- a/glib/gasyncqueue.c +++ b/glib/gasyncqueue.c @@ -64,14 +64,18 @@ g_async_queue_new (void) * * Increases the reference count of the asynchronous @queue by 1. You * do not need to hold the lock to call this function. + * + * Returns: the @queue that was passed in (since 2.6) **/ -void +GAsyncQueue * g_async_queue_ref (GAsyncQueue *queue) { g_return_if_fail (queue); g_return_if_fail (g_atomic_int_get (&queue->ref_count) > 0); g_atomic_int_inc (&queue->ref_count); + + return queue; } /** diff --git a/glib/gasyncqueue.h b/glib/gasyncqueue.h index 80044e0bc..e26add9b7 100644 --- a/glib/gasyncqueue.h +++ b/glib/gasyncqueue.h @@ -47,7 +47,7 @@ void g_async_queue_lock (GAsyncQueue *queue); void g_async_queue_unlock (GAsyncQueue *queue); /* Ref and unref the GAsyncQueue. */ -void g_async_queue_ref (GAsyncQueue *queue); +GAsyncQueue* g_async_queue_ref (GAsyncQueue *queue); void g_async_queue_unref (GAsyncQueue *queue); #ifndef G_DISABLE_DEPRECATED /* You don't have to hold the lock for calling *_ref and *_unref anymore. */ diff --git a/glib/ghook.c b/glib/ghook.c index 70d3e36bd..83ef80979 100644 --- a/glib/ghook.c +++ b/glib/ghook.c @@ -222,7 +222,7 @@ g_hook_unref (GHookList *hook_list, } } -void +GHook * g_hook_ref (GHookList *hook_list, GHook *hook) { @@ -231,6 +231,8 @@ g_hook_ref (GHookList *hook_list, g_return_if_fail (hook->ref_count > 0); hook->ref_count++; + + return hook; } void diff --git a/glib/ghook.h b/glib/ghook.h index 422284c07..a552bfb0c 100644 --- a/glib/ghook.h +++ b/glib/ghook.h @@ -105,7 +105,7 @@ void g_hook_list_clear (GHookList *hook_list); GHook* g_hook_alloc (GHookList *hook_list); void g_hook_free (GHookList *hook_list, GHook *hook); -void g_hook_ref (GHookList *hook_list, +GHook * g_hook_ref (GHookList *hook_list, GHook *hook); void g_hook_unref (GHookList *hook_list, GHook *hook); diff --git a/glib/giochannel.c b/glib/giochannel.c index 1436ab496..c911a2687 100644 --- a/glib/giochannel.c +++ b/glib/giochannel.c @@ -91,12 +91,14 @@ g_io_channel_init (GIOChannel *channel) channel->close_on_unref = FALSE; } -void +GIOChannel * g_io_channel_ref (GIOChannel *channel) { g_return_if_fail (channel != NULL); channel->ref_count++; + + return channel; } void diff --git a/glib/giochannel.h b/glib/giochannel.h index b23be3e64..aa812be49 100644 --- a/glib/giochannel.h +++ b/glib/giochannel.h @@ -163,7 +163,7 @@ struct _GIOFuncs }; void g_io_channel_init (GIOChannel *channel); -void g_io_channel_ref (GIOChannel *channel); +GIOChannel *g_io_channel_ref (GIOChannel *channel); void g_io_channel_unref (GIOChannel *channel); #ifndef G_DISABLE_DEPRECATED diff --git a/glib/gmain.c b/glib/gmain.c index c522aba24..7ee0b1a05 100644 --- a/glib/gmain.c +++ b/glib/gmain.c @@ -589,8 +589,10 @@ g_poll (GPollFD *fds, * @context: a #GMainContext * * Increases the reference count on a #GMainContext object by one. + * + * Returns: the @context that was passed in (since 2.6) **/ -void +GMainContext * g_main_context_ref (GMainContext *context) { g_return_if_fail (context != NULL); diff --git a/glib/gmain.h b/glib/gmain.h index 66fb51c88..2bbf60768 100644 --- a/glib/gmain.h +++ b/glib/gmain.h @@ -136,7 +136,7 @@ struct _GPollFD /* GMainContext: */ GMainContext *g_main_context_new (void); -void g_main_context_ref (GMainContext *context); +GMainContext *g_main_context_ref (GMainContext *context); void g_main_context_unref (GMainContext *context); GMainContext *g_main_context_default (void);