lkml.org 
[lkml]   [2021]   [Nov]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] libtraceevent: use swap() to make code cleaner
Date
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Signed-off-by: Yihao Han <hanyihao@vivo.com>
---
tools/lib/traceevent/event-parse.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index fe58843d047c..71bddcc9ff3b 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -2081,14 +2081,10 @@ process_op(struct tep_event *event, struct tep_print_arg *arg, char **tok)

if (right->type == TEP_PRINT_OP &&
get_op_prio(arg->op.op) < get_op_prio(right->op.op)) {
- struct tep_print_arg tmp;
-
/* rotate ops according to the priority */
arg->op.right = right->op.left;

- tmp = *arg;
- *arg = *right;
- *right = tmp;
+ swap(*arg, *right);

arg->op.left = right;
} else {
--
2.17.1
\
 
 \ /
  Last update: 2021-11-12 04:03    [W:1.340 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site