From: Dmitry V. Levin Date: Sun, 18 Dec 2016 17:06:29 +0000 (+0000) Subject: Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions X-Git-Tag: v4.16~342 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=832fd63fc4aa3aa0dc2a7c501e577f7ee550db4e;p=strace Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions * defs.h (SCNO_IN_RANGE, SCNO_IS_VALID): Transform into static inline functions. --- diff --git a/defs.h b/defs.h index 8af37dcb..8cd4f9f6 100644 --- a/defs.h +++ b/defs.h @@ -877,18 +877,25 @@ extern struct fault_opts *fault_vec[SUPPORTED_PERSONALITIES]; # define MPERS_PRINTER_DECL(type, name, ...) type MPERS_FUNC_NAME(name)(__VA_ARGS__) #endif /* !IN_MPERS_BOOTSTRAP */ +/* Checks that sysent[scno] is not out of range. */ +static inline bool +SCNO_IN_RANGE(unsigned long scno) +{ + return scno < nsyscalls; +} + /* - * If you need non-NULL sysent[scno].sys_func, non-NULL sysent[scno].sys_name, - * and non-indirect sysent[scno].sys_flags. + * Checks whether scno is not out of range, + * its corresponding sysent[scno].sys_func is non-NULL, + * and its sysent[scno].sys_flags has no TRACE_INDIRECT_SUBCALL flag set. */ -#define SCNO_IS_VALID(scno) \ - ((unsigned long)(scno) < nsyscalls \ - && sysent[scno].sys_func \ - && !(sysent[scno].sys_flags & TRACE_INDIRECT_SUBCALL)) - -/* Only ensures that sysent[scno] isn't out of range */ -#define SCNO_IN_RANGE(scno) \ - ((unsigned long)(scno) < nsyscalls) +static inline bool +SCNO_IS_VALID(unsigned long scno) +{ + return SCNO_IN_RANGE(scno) + && sysent[scno].sys_func + && !(sysent[scno].sys_flags & TRACE_INDIRECT_SUBCALL); +} #define MPERS_FUNC_NAME__(prefix, name) prefix ## name #define MPERS_FUNC_NAME_(prefix, name) MPERS_FUNC_NAME__(prefix, name)