[Bug 53202] Improve mc-tool

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Aug 8 11:23:04 CEST 2012


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

--- Comment #4 from Simon McVittie <simon.mcvittie at collabora.co.uk> 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));

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



More information about the telepathy-bugs mailing list