Skip to contentSkip to conversation

libtraceevent: use swap() to make code cleaner

PATCH New Yihao Han 1 participant 1 message Nov 12, 2021

lore
Share & tools
lore

Yihao Han

author
#0 lore raw

PATCH 1/1 libtraceevent: use swap() to make code cleaner

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid opencoding it.

---
 tools/lib/traceevent/event-parse.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
tools/lib/traceevent/event-parse.c +1 -5
index fe58843d047c..71bddcc9ff3b 100644
@@ -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 {
Signature · 1 line
2.17.1