mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-11 20:48:27 +00:00
lib: move frr_weak_random to header file
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>
This commit is contained in:
parent
6968b038eb
commit
3c191fb138
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user