[syslinux] [PATCH 3/4] sys/times.h: Mark times() static inline
Matt Fleming
matt at console-pimps.org
Thu Feb 17 14:03:27 PST 2011
From: Matt Fleming <matt.fleming at linux.intel.com>
As times() is just an accessor function for accessing __ms_timer it's
worth marking it as static inline so that we don't incur any function
call overhead just for accessing a symbol.
Signed-off-by: Matt Fleming <matt.fleming at linux.intel.com>
---
com32/include/sys/times.h | 8 +++++++-
com32/lib/sys/times.c | 42 ------------------------------------------
2 files changed, 7 insertions(+), 43 deletions(-)
delete mode 100644 com32/lib/sys/times.c
diff --git a/com32/include/sys/times.h b/com32/include/sys/times.h
index 9047006..5eda295 100644
--- a/com32/include/sys/times.h
+++ b/com32/include/sys/times.h
@@ -16,6 +16,12 @@ struct tms {
typedef uint32_t clock_t;
-clock_t times(struct tms *);
+extern volatile uint32_t __ms_timer;
+
+static inline clock_t times(struct tms *buf)
+{
+ (void)buf;
+ return __ms_timer;
+}
#endif /* _SYS_TIMES_H */
diff --git a/com32/lib/sys/times.c b/com32/lib/sys/times.c
deleted file mode 100644
index 518ba82..0000000
--- a/com32/lib/sys/times.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ----------------------------------------------------------------------- *
- *
- * Copyright 2004-2008 H. Peter Anvin - All Rights Reserved
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom
- * the Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall
- * be included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * ----------------------------------------------------------------------- */
-
-/*
- * sys/times.c
- *
- * Returns something like a clock.
- */
-
-#include <sys/times.h>
-#include <syslinux/pmapi.h>
-#include <com32.h>
-
-clock_t times(struct tms * buf)
-{
- (void)buf;
- return __ms_timer;
-}
--
1.7.4
More information about the Syslinux
mailing list