From 4c3d1d35211e789a14352787f16c2db2fc6293f7 Mon Sep 17 00:00:00 2001 From: Michael Forney 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. --- defs.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/defs.h b/defs.h index 732542e4..e7ff7d0b 100644 --- a/defs.h +++ b/defs.h @@ -374,8 +374,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.28.0