summaryrefslogtreecommitdiff
path: root/libsoup
diff options
context:
space:
mode:
authorPatrick Griffis <pgriffis@igalia.com>2020-11-13 13:10:08 -0600
committerPatrick Griffis <pgriffis@igalia.com>2020-11-13 13:10:08 -0600
commitcafdabc8c47027c2a122f8e200cf32f2ee266c63 (patch)
tree710aeca8b932fb6ee9f9e5248b27b2e4d07e3e79 /libsoup
parent876b7417e62d40bc977272bd4adc12e73447bb0b (diff)
downloadlibsoup-cafdabc8c47027c2a122f8e200cf32f2ee266c63.tar.gz
Change soup_add_timeout() to transfer ownership
This is more clear for static analysis.
Diffstat (limited to 'libsoup')
-rw-r--r--libsoup/cache/soup-cache.c2
-rw-r--r--libsoup/soup-connection.c2
-rw-r--r--libsoup/soup-misc.c3
-rw-r--r--libsoup/soup-session.c1
4 files changed, 4 insertions, 4 deletions
diff --git a/libsoup/cache/soup-cache.c b/libsoup/cache/soup-cache.c
index e97d822e..d5c4354b 100644
--- a/libsoup/cache/soup-cache.c
+++ b/libsoup/cache/soup-cache.c
@@ -1290,6 +1290,8 @@ soup_cache_flush (SoupCache *cache)
g_source_destroy (timeout);
else
g_warning ("Cache flush finished despite %d pending requests", priv->n_pending);
+
+ g_source_unref (timeout);
}
typedef void (* SoupCacheForeachFileFunc) (SoupCache *cache, const char *name, gpointer user_data);
diff --git a/libsoup/soup-connection.c b/libsoup/soup-connection.c
index 9b50054c..f3b3acf7 100644
--- a/libsoup/soup-connection.c
+++ b/libsoup/soup-connection.c
@@ -296,7 +296,7 @@ stop_idle_timer (SoupConnectionPrivate *priv)
{
if (priv->idle_timeout_src) {
g_source_destroy (priv->idle_timeout_src);
- priv->idle_timeout_src = NULL;
+ g_clear_pointer (&priv->idle_timeout_src, g_source_unref);
}
}
diff --git a/libsoup/soup-misc.c b/libsoup/soup-misc.c
index a8a4d19f..4f5c28ce 100644
--- a/libsoup/soup-misc.c
+++ b/libsoup/soup-misc.c
@@ -100,7 +100,7 @@ soup_add_completion (GMainContext *async_context,
* Adds a timeout as with g_timeout_add(), but using the given
* @async_context.
*
- * Return value: a #GSource, which can be removed from @async_context
+ * Returns: (transfer full): a #GSource, which can be removed from @async_context
* with g_source_destroy().
**/
GSource *
@@ -111,7 +111,6 @@ soup_add_timeout (GMainContext *async_context,
GSource *source = g_timeout_source_new (interval);
g_source_set_callback (source, function, data, NULL);
g_source_attach (source, async_context);
- g_source_unref (source);
return source;
}
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c
index 4ecd1d8a..7fbb242f 100644
--- a/libsoup/soup-session.c
+++ b/libsoup/soup-session.c
@@ -1079,7 +1079,6 @@ drop_connection (SoupSession *session, SoupSessionHost *host, SoupConnection *co
HOST_KEEP_ALIVE,
free_unused_host,
host);
- host->keep_alive_src = g_source_ref (host->keep_alive_src);
}
}