Module: kamailio Branch: master Commit: 12ef4b4e64e596a3ce29775266cef571796f0850 URL: https://github.com/kamailio/kamailio/commit/12ef4b4e64e596a3ce29775266cef571...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2025-02-06T08:09:20+01:00
core: rand - switch to inline functions from macros
- rand/random has no parameter
---
Modified: src/core/rand/kam_rand.h
---
Diff: https://github.com/kamailio/kamailio/commit/12ef4b4e64e596a3ce29775266cef571... Patch: https://github.com/kamailio/kamailio/commit/12ef4b4e64e596a3ce29775266cef571...
---
diff --git a/src/core/rand/kam_rand.h b/src/core/rand/kam_rand.h index 271f61f220d..12b988a0852 100644 --- a/src/core/rand/kam_rand.h +++ b/src/core/rand/kam_rand.h @@ -24,12 +24,24 @@
#if RAND_MAX < INT_MAX #define KAM_RAND_MAX ((int)(0x7FFFFFFF)) /* (1<<31) - 1 */ -#define kam_rand(x) ((int)random(x)) -#define kam_srand(x) srandom(x) +static inline int kam_rand(void) +{ + return (int)random(); +} +static inline void kam_srand(unsigned int seed) +{ + return srandom(seed); +} #else #define KAM_RAND_MAX RAND_MAX -#define kam_rand(x) rand(x) -#define kam_srand(x) srand(x) +static inline int kam_rand(void) +{ + return rand(); +} +static inline void kam_srand(unsigned int seed) +{ + return srand(seed); +} #endif
#endif