cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1834?usp=email )
Change subject: Remove local get_random in test_misc.c ...................................................................... Remove local get_random in test_misc.c The get_random in test_misc.c conflicts with the get_random function that OpenVPN defines in crypto.h Also adjust the implementation in mock_get_random.c to match the prototype in crypto.h Change-Id: I3db70001be7f39cf84d562517647f1a305962b42 Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Acked-by: Antonio Quartulli <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1834 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg38155.html Signed-off-by: Gert Doering <[email protected]> --- M tests/unit_tests/openvpn/mock_get_random.c M tests/unit_tests/openvpn/test_misc.c 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tests/unit_tests/openvpn/mock_get_random.c b/tests/unit_tests/openvpn/mock_get_random.c index 0840e31..5cb768b 100644 --- a/tests/unit_tests/openvpn/mock_get_random.c +++ b/tests/unit_tests/openvpn/mock_get_random.c @@ -28,7 +28,7 @@ #include <stdint.h> #include <cmocka.h> -unsigned long +int64_t get_random(void) { /* rand() is not very random, but it's C99 and this is just for testing */ diff --git a/tests/unit_tests/openvpn/test_misc.c b/tests/unit_tests/openvpn/test_misc.c index cd86fd2..4d046ce 100644 --- a/tests/unit_tests/openvpn/test_misc.c +++ b/tests/unit_tests/openvpn/test_misc.c @@ -38,6 +38,7 @@ #include "test_common.h" #include "list.h" #include "mock_msg.h" +#include "crypto.h" #ifdef _WIN32 #include "win32-util.h" #endif @@ -143,13 +144,6 @@ return strcmp((const char *)key1, (const char *)key2) == 0; } -static uint32_t -get_random(void) -{ - /* rand() is not very random, but it's C99 and this is just for testing */ - return (uint32_t)rand(); -} - static struct hash_element * hash_lookup_by_value(struct hash *hash, void *value) { @@ -266,7 +260,7 @@ { struct hash_iterator hi; struct hash_element *he; - inc = (get_random() % 3) + 1; + inc = ((uint32_t)get_random() % 3) + 1; hash_iterator_init_range(hash, &hi, base, base + inc); while ((he = hash_iterator_next(&hi))) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1834?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I3db70001be7f39cf84d562517647f1a305962b42 Gerrit-Change-Number: 1834 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos <[email protected]> Gerrit-Reviewer: flichtenheld <[email protected]> Gerrit-Reviewer: ordex <[email protected]> Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
