]> git.puffer.fish Git - mirror/frr.git/commitdiff
lib: move frr_weak_random to header file
authorDavid Lamparter <equinox@diac24.net>
Fri, 1 May 2020 08:59:53 +0000 (10:59 +0200)
committerDavid Lamparter <equinox@diac24.net>
Mon, 1 Feb 2021 16:08:13 +0000 (17:08 +0100)
Makes more sense to have this as a static inline.  Also I don't want to
be forced to link network.o into clippy ;)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/network.c
lib/network.h

index d2482bd55e7e53bc96c1ad2f1e5c56238c282a7f..411661a5e1bca1764803289f0edad2f373794acf 100644 (file)
@@ -121,21 +121,3 @@ float ntohf(float net)
 {
        return htonf(net);
 }
-
-/**
- * Helper function that returns a random long value. The main purpose of
- * this function is to hide a `random()` call that gets flagged by coverity
- * scan and put it into one place.
- *
- * The main usage of this function should be for generating jitter or weak
- * random values for simple purposes.
- *
- * See 'man 3 random' for more information.
- *
- * \returns random long integer.
- */
-long frr_weak_random(void)
-{
-       /* coverity[dont_call] */
-       return random();
-}
index 83c9e59e760853479395d720e43f4e0ae986d5f7..4a9666984fad3ad51c0e6942b6d9ee1ec4ecf5f1 100644 (file)
@@ -45,7 +45,23 @@ extern int set_cloexec(int fd);
 extern float htonf(float);
 extern float ntohf(float);
 
-extern long frr_weak_random(void);
+/**
+ * Helper function that returns a random long value. The main purpose of
+ * this function is to hide a `random()` call that gets flagged by coverity
+ * scan and put it into one place.
+ *
+ * The main usage of this function should be for generating jitter or weak
+ * random values for simple purposes.
+ *
+ * See 'man 3 random' for more information.
+ *
+ * \returns random long integer.
+ */
+static inline long frr_weak_random(void)
+{
+       /* coverity[dont_call] */
+       return random();
+}
 
 #ifdef __cplusplus
 }