[telepathy-glib/master] handle-repo: warn if the results of allocators are ignored (i.e. leaked)
Simon McVittie
simon.mcvittie at collabora.co.uk
Fri Dec 18 09:44:45 PST 2009
In the case of tp_handle_set_update and tp_handle_set_difference_update,
it's important that we warn, because a casual observer could miss the fact
that these functions return the difference and assume that they're void,
leaking the result.
---
telepathy-glib/handle-repo.h | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/telepathy-glib/handle-repo.h b/telepathy-glib/handle-repo.h
index 5580205..b0de534 100644
--- a/telepathy-glib/handle-repo.h
+++ b/telepathy-glib/handle-repo.h
@@ -101,7 +101,8 @@ const char *tp_handle_inspect (TpHandleRepoIface *self,
TpHandle tp_handle_lookup (TpHandleRepoIface *self,
const gchar *id, gpointer context, GError **error);
TpHandle tp_handle_ensure (TpHandleRepoIface *self,
- const gchar *id, gpointer context, GError **error);
+ const gchar *id, gpointer context, GError **error)
+ G_GNUC_WARN_UNUSED_RESULT;
void tp_handle_set_qdata (TpHandleRepoIface *repo, TpHandle handle,
GQuark key_id, gpointer data, GDestroyNotify destroy);
@@ -122,7 +123,8 @@ gpointer tp_handle_get_qdata (TpHandleRepoIface *repo, TpHandle handle,
typedef void (*TpHandleSetMemberFunc)(TpHandleSet *set, TpHandle handle,
gpointer userdata);
-TpHandleSet * tp_handle_set_new (TpHandleRepoIface *repo);
+TpHandleSet * tp_handle_set_new (TpHandleRepoIface *repo)
+ G_GNUC_WARN_UNUSED_RESULT;
void tp_handle_set_destroy (TpHandleSet *set);
TpIntSet *tp_handle_set_peek (TpHandleSet *set);
@@ -135,11 +137,12 @@ void tp_handle_set_foreach (TpHandleSet *set, TpHandleSetMemberFunc func,
gpointer userdata);
int tp_handle_set_size (TpHandleSet *set);
-GArray *tp_handle_set_to_array (TpHandleSet *set);
+GArray *tp_handle_set_to_array (TpHandleSet *set) G_GNUC_WARN_UNUSED_RESULT;
-TpIntSet *tp_handle_set_update (TpHandleSet *set, const TpIntSet *add);
+TpIntSet *tp_handle_set_update (TpHandleSet *set, const TpIntSet *add)
+ G_GNUC_WARN_UNUSED_RESULT;
TpIntSet *tp_handle_set_difference_update (TpHandleSet *set,
- const TpIntSet *remove);
+ const TpIntSet *remove) G_GNUC_WARN_UNUSED_RESULT;
/* static inline because it relies on NUM_TP_HANDLE_TYPES */
/**
--
1.5.6.5
More information about the telepathy-commits
mailing list