]> git.ipfire.org Git - thirdparty/libarchive.git/commit
Improve readability of ternary expression checking for empty string
authorBrad King <brad.king@kitware.com>
Wed, 21 Oct 2015 15:59:45 +0000 (11:59 -0400)
committerBrad King <brad.king@kitware.com>
Mon, 26 Oct 2015 14:17:49 +0000 (10:17 -0400)
commit72afc6f0e8f3cec187969354d63ad18574102718
tree8cbe035c10d63f160b5cb20296b089d3fa6ea21f
parenta81ffc0723ecfb8699280fcd01e2380e46029f94
Improve readability of ternary expression checking for empty string

In expressions of the form

    m != NULL && m[0] == '\0' ? NULL : m

the goal is to get a `NULL` pointer if `m` is either `NULL` or an empty
string.  This is not clear because in the `m == NULL` case we use the
`m` side to get `NULL` instead of an explicit `NULL`.  Clarify the
intent by using the form

    (m != NULL && m[0] != '\0') ? m : NULL;

instead.
libarchive/archive_options.c