Bug 53202

Summary: Improve mc-tool
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: mission-controlAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: enhancement    
Priority: medium Keywords: patch
Version: git master   
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/cassidy/telepathy-mission-control/log/?h=mc-tool-53202
Whiteboard: review+
i915 platform: i915 features:

Description Guillaume Desmottes 2012-08-07 08:14:39 UTC
Would be cool to have Account.Storage settings available in mc-tool.
Comment 2 Jonny Lamb 2012-08-08 08:43:41 UTC
Looks fine. "Restrictions: (null)" might not look so pretty, perhaps if (flags == 0) return g_strdup ("(none)"); in dup_storage_restrictions? Feel free to ignore this though.
Comment 3 Guillaume Desmottes 2012-08-08 09:07:22 UTC
I was about to answer "but that's exactly what I did" but it looks like I didn't actually write it (but I was about to :).

Anyway, I changed it as you suggested and merged the branch to master (for 5.13.1). Thanks for the review.
Comment 4 Simon McVittie 2012-08-08 09:23:04 UTC
(In reply to comment #2)
> "Restrictions: (null)" might not look so pretty

For future reference, printf ("%s", NULL) (and the rest of the *printf family) will crash on at least Solaris. glibc is nice to us and produces "(null)", but the C standards don't require that this works.

Some projects have a macro or inline function like this:

#define NULLSTR(x) (x ? x : "")

or (safer because it only evaluates its argument once, and IMO better-named too)

static inline const char *
unnullify_string (const char *x)
{
  return (x ? x : "");
}

so that you can do

    printf ("%s", NULLSTR (tp_connection_get_detailed_error (c, NULL));

or

    printf ("%s", unnullify_string (tp_connection_get_detailed_error (c, NULL));

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.