]> granicus.if.org Git - strace/commitdiff
Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 18 Dec 2016 17:06:29 +0000 (17:06 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 18 Dec 2016 22:57:57 +0000 (22:57 +0000)
* defs.h (SCNO_IN_RANGE, SCNO_IS_VALID): Transform into static inline
functions.

defs.h

diff --git a/defs.h b/defs.h
index 8af37dcb02c3cd92d69e26abf7722f97bd9ff299..8cd4f9f6d4e0506908a34ed6c6ee46ee60d01aff 100644 (file)
--- 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)