Module: kamailio
Branch: master
Commit: 12ef4b4e64e596a3ce29775266cef571796f0850
URL: 
https://github.com/kamailio/kamailio/commit/12ef4b4e64e596a3ce29775266cef571796f0850

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@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/12ef4b4e64e596a3ce29775266cef571796f0850.diff
Patch: 
https://github.com/kamailio/kamailio/commit/12ef4b4e64e596a3ce29775266cef571796f0850.patch

---

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

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to