git: e74014c897b3 - main - net/rsplib: Fix build with -DNDEBUG defined
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 20 Oct 2022 09:24:15 UTC
The branch main has been updated by diizzy: URL: https://cgit.FreeBSD.org/ports/commit/?id=e74014c897b3de44a201b304b24b2b36bcda8e0c commit e74014c897b3de44a201b304b24b2b36bcda8e0c Author: Daniel Engberg <diizzy@FreeBSD.org> AuthorDate: 2022-10-20 09:12:37 +0000 Commit: Daniel Engberg <diizzy@FreeBSD.org> CommitDate: 2022-10-20 09:24:09 +0000 net/rsplib: Fix build with -DNDEBUG defined Disable usage of OMNeT++ random generator when -DNDEBUG is defined PR: 266721 Reported by: antoine (via exp-run) Approved by: portmgr (build fix) --- net/rsplib/files/patch-src_randomizer.c | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/net/rsplib/files/patch-src_randomizer.c b/net/rsplib/files/patch-src_randomizer.c new file mode 100644 index 000000000000..667c7c707bdd --- /dev/null +++ b/net/rsplib/files/patch-src_randomizer.c @@ -0,0 +1,47 @@ +--- src/randomizer.c.orig 2021-02-17 14:14:20 UTC ++++ src/randomizer.c +@@ -32,13 +32,12 @@ + #include <math.h> + #include <stdlib.h> + +- ++/* + #ifdef NDEBUG + #undef min + #undef max + #include <omnetpp.h> + #else +-/* + It is tried to use /dev/urandom as random source first, since + it provides high-quality random numbers. If /dev/urandom is not + available, use the clib's random() function with a seed given +@@ -56,7 +55,6 @@ + + static int RandomSource = RS_TRY_DEVICE; + static FILE* RandomDevice = NULL; +-#endif + + + +@@ -84,11 +82,13 @@ uint64_t random64() + /* ###### Get 32-bit random value ######################################## */ + uint32_t random32() + { ++/* + #ifdef NDEBUG + #warning Using OMNeT++ random generator instead of time-seeded one! + const double value = uniform(0.0, (double)0xffffffff); + return((uint32_t)rint(value)); + #else ++*/ + uint32_t number; + + switch(RandomSource) { +@@ -116,7 +116,6 @@ uint32_t random32() + break; + } + return(random()); +-#endif + } + +