Browse Source

jacobson_karels: Add missing inline keyword

Forgot the 'inline' in 'static inline' in the functions defined in the
header, which means that lots of warnings will be generated, if you include
the header but don't use the functions.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
David Gibson 11 years ago
parent
commit
23636f5911
2 changed files with 9 additions and 3 deletions
  1. 3 3
      ccan/jacobson_karels/jacobson_karels.h
  2. 6 0
      ccan/jacobson_karels/test/run-nouse.c

+ 3 - 3
ccan/jacobson_karels/jacobson_karels.h

@@ -10,13 +10,13 @@
 	struct _name##_state { \
 	struct _name##_state { \
 		_type rtt, variance; \
 		_type rtt, variance; \
 	}; \
 	}; \
-	static void _name##_init(struct _name##_state *s, \
+	static inline void _name##_init(struct _name##_state *s, \
 				 _type rtt0, _type var0)  \
 				 _type rtt0, _type var0)  \
 	{ \
 	{ \
 		s->rtt = rtt0; \
 		s->rtt = rtt0; \
 		s->variance = var0; \
 		s->variance = var0; \
 	} \
 	} \
-	static void _name##_update(struct _name##_state *s, _type sample) \
+	static inline void _name##_update(struct _name##_state *s, _type sample) \
 	{ \
 	{ \
 		_type diff = sample - s->rtt; \
 		_type diff = sample - s->rtt; \
 		s->rtt += (_a2) * diff / ((_a1) + (_a2)); \
 		s->rtt += (_a2) * diff / ((_a1) + (_a2)); \
@@ -24,7 +24,7 @@
 		s->variance = ((_b1)*s->variance + (_b2) * diff) \
 		s->variance = ((_b1)*s->variance + (_b2) * diff) \
 			/ ((_b1) + (_b2));			 \
 			/ ((_b1) + (_b2));			 \
 	} \
 	} \
-	static _type _name##_timeout(struct _name##_state *s, \
+	static inline _type _name##_timeout(struct _name##_state *s, \
 				     _type tmin, _type tmax)  \
 				     _type tmin, _type tmax)  \
 	{ \
 	{ \
 		return clamp((_g) * s->rtt + (_k)*s->variance, tmin, tmax); \
 		return clamp((_g) * s->rtt + (_k)*s->variance, tmin, tmax); \

+ 6 - 0
ccan/jacobson_karels/test/run-nouse.c

@@ -0,0 +1,6 @@
+#include <ccan/jacobson_karels/jacobson_karels.h>
+
+int main(int argc, char *argv[])
+{
+	return 0;
+}