bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] libbpf: Delete an unneeded bool conversion
@ 2021-05-10 12:43 Zhen Lei
  2021-05-10 18:00 ` Andrii Nakryiko
  0 siblings, 1 reply; 7+ messages in thread
From: Zhen Lei @ 2021-05-10 12:43 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, netdev, bpf
  Cc: Zhen Lei

The result of an expression consisting of a single relational operator is
already of the bool type and does not need to be evaluated explicitly.

No functional change.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index e2a3cf4378140f2..fa02213c451f4d2 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -1504,7 +1504,7 @@ static int set_kcfg_value_tri(struct extern_desc *ext, void *ext_val,
 				ext->name, value);
 			return -EINVAL;
 		}
-		*(bool *)ext_val = value == 'y' ? true : false;
+		*(bool *)ext_val = value == 'y';
 		break;
 	case KCFG_TRISTATE:
 		if (value == 'y')
-- 
2.26.0.106.g9fadedd



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-13  6:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 12:43 [PATCH 1/1] libbpf: Delete an unneeded bool conversion Zhen Lei
2021-05-10 18:00 ` Andrii Nakryiko
2021-05-11  5:09   ` Leon Romanovsky
2021-05-12 19:02     ` Andrii Nakryiko
2021-05-13  2:14       ` Leizhen (ThunderTown)
2021-05-13  6:22         ` Leon Romanovsky
2021-05-13  6:31       ` Leon Romanovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).