From: Steve Lawrence <slawrence@tresys.com>
To: SELinux List <selinux@tycho.nsa.gov>
Subject: [PATCH] libsepol/cil: Remove duplicated 'if' condition in cil_tree
Date: Tue, 1 Dec 2015 15:38:47 -0500 [thread overview]
Message-ID: <1449002327-32333-1-git-send-email-slawrence@tresys.com> (raw)
David Binderman wrote:
> Hello there,
>
> ./cil/src/cil_tree.c:1279:36: warning: duplicated 'if' condition [-Wduplicated-cond]
>
> Source code is
>
> if (filecon->context_str != NULL) {
> cil_log(CIL_INFO, " %s", filecon->context_str);
> } else if (filecon->context != NULL) {
> cil_tree_print_context(filecon->context);
> } else if (filecon->context_str != NULL) {
> cil_log(CIL_INFO, " %s", filecon->context_str);
> }
>
> Two mentions of filecon->context_str. Suggest code rework.
Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Steve Lawrence <slawrence@tresys.com>
---
libsepol/cil/src/cil_tree.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libsepol/cil/src/cil_tree.c b/libsepol/cil/src/cil_tree.c
index f641baa..8357a32 100644
--- a/libsepol/cil/src/cil_tree.c
+++ b/libsepol/cil/src/cil_tree.c
@@ -1302,9 +1302,7 @@ void cil_tree_print_node(struct cil_tree_node *node)
cil_log(CIL_INFO, "FILECON:");
cil_log(CIL_INFO, " %s %d", filecon->path_str, filecon->type);
- if (filecon->context_str != NULL) {
- cil_log(CIL_INFO, " %s", filecon->context_str);
- } else if (filecon->context != NULL) {
+ if (filecon->context != NULL) {
cil_tree_print_context(filecon->context);
} else if (filecon->context_str != NULL) {
cil_log(CIL_INFO, " %s", filecon->context_str);
--
2.4.3
reply other threads:[~2015-12-01 20:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1449002327-32333-1-git-send-email-slawrence@tresys.com \
--to=slawrence@tresys.com \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.