[Bug 27772] de-obfuscate self->priv access

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Apr 22 18:18:05 CEST 2010


https://bugs.freedesktop.org/show_bug.cgi?id=27772

--- Comment #2 from Travis Reitter <travis.reitter at collabora.co.uk> 2010-04-22 09:18:05 PDT ---
(In reply to comment #0)
> The logger's GET_PRIV macros are neither obvious nor type-safe. self->priv (as
> used in telepathy-glib) is (usually) less typing, and considerably safer.
> 
> See the branch:
> 
> http://git.collabora.co.uk/?p=user/smcv/telepathy-logger.git;a=shortlog;h=refs/heads/get-priv-easier

This branch mostly looks good, though I think we should go a step farther and
only deref self (for self->priv) after g_return_if_fail (TP_IS_<TYPE> (self));

Many of the functions either already have this check or it shouldn't matter
(eg, the dispose and finalize functions, and, arguably, any static functions),
but many non-static functions (eg, in tpl-contact.) only perform this check
after dereffing self.

Feel free to commit after fixing those, or if I'm missing something that
guarantees self->priv is always safe given an arbitrary pointer, without
confirming its type (and that it's non-NULL, like the _IS_TYPE() macros do).

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.



More information about the telepathy-bugs mailing list