Skip to contentSkip to conversation

common_timers: staticize all definitions

PATCH New Viresh Kumar 3 participants 3 messages Apr 28, 2020 – May 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 common_timers: staticize all definitions

Staticize all variable and function definitions to avoid build failures in the future if this gets included by multiple files.

---
Make clock_list static const to avoid warnings.

 include/lapi/common_timers.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/lapi/common_timers.h +4 -4
index df4196eeb579..b783beff4f8b 100644
@@ -15,7 +15,7 @@
 #define NSEC_PER_SEC (1000000000L)
 #endif
 
-clock_t clock_list[] = {
+static const clock_t clock_list[] = {
 	CLOCK_REALTIME,
 	CLOCK_MONOTONIC,
 	CLOCK_PROCESS_CPUTIME_ID,
@@ -34,7 +34,7 @@ clock_t clock_list[] = {
 	case def_name:		\
 		return #def_name;
 
-const char *get_clock_str(const int clock_id)
+static inline const char *get_clock_str(const int clock_id)
 {
 	switch (clock_id) {
 	CLOCK_TO_STR(CLOCK_REALTIME);
@@ -50,7 +50,7 @@ const char *get_clock_str(const int clock_id)
 	}
 }
 
-int possibly_unsupported(clock_t clock)
+static inline int possibly_unsupported(clock_t clock)
 {
 	switch (clock) {
 	case CLOCK_BOOTTIME:
@@ -63,7 +63,7 @@ int possibly_unsupported(clock_t clock)
 	}
 }
 
-int have_cputime_timers(void)
+static inline int have_cputime_timers(void)
 {
 	return tst_kvercmp(2, 6, 12) >= 0;
 }
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
#1 lore raw

PATCH v2 1/1 common_timers: staticize all definitions

Hi,

Quoted 2 lines

Staticize all variable and function definitions to avoid build failures in the future if this gets included by multiple files.

Kind regards,
Petr