summaryrefslogtreecommitdiff
path: root/pkg/strace/patch/0003-Make-tcp_sysent-a-static-inline-function.patch
blob: df4203826af8b2aa717d050f1c0b13efd0091719 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
From 42f2ce6f4e8cd2e6e1667088da58e237afc2cbb0 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sat, 6 Jul 2019 01:40:36 -0700
Subject: [PATCH] Make tcp_sysent a static inline function

This way we can include the second operand to the conditional
operator without evaluating the macro argument multiple times.
---
 src/defs.h | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/defs.h b/src/defs.h
index 71cec62b4..56b2882b6 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -397,8 +397,12 @@ struct tcb {
 # define syscall_tampered_nofail(tcp) ((tcp)->flags & TCB_TAMPERED_NO_FAIL)
 # define has_seccomp_filter(tcp)	((tcp)->flags & TCB_SECCOMP_FILTER)
 
-extern const struct_sysent stub_sysent;
-# define tcp_sysent(tcp) (tcp->s_ent ?: &stub_sysent)
+static inline const struct_sysent *
+tcp_sysent(struct tcb *tcp)
+{
+	extern const struct_sysent stub_sysent;
+	return tcp->s_ent ? tcp->s_ent : &stub_sysent;
+}
 # define n_args(tcp) (tcp_sysent(tcp)->nargs)
 
 # include "xlat.h"
-- 
2.34.1