From f2f45339dc378ed4d15b19ebf8d16e9f58d776e8 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 17 Sep 2009 14:23:27 +0000 Subject: Moved Curl_rand() and Curl_srand() code from formdata.c and formdata.h into curl_rand.c and curl_rand.h --- lib/formdata.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'lib/formdata.c') diff --git a/lib/formdata.c b/lib/formdata.c index 8538e9f91..ab5f99118 100644 --- a/lib/formdata.c +++ b/lib/formdata.c @@ -108,12 +108,6 @@ Content-Disposition: form-data; name="FILECONTENT" /* Length of the random boundary string. */ #define BOUNDARY_LENGTH 40 -/* Private pseudo-random number seed. Unsigned integer >= 32bit. Threads - mutual exclusion is not implemented to acess it since we do not require - high quality random numbers (only used in form boudary generation). */ - -static unsigned int randseed; - #if !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) #include @@ -127,6 +121,7 @@ static unsigned int randseed; #include "urldata.h" /* for struct SessionHandle */ #include "easyif.h" /* for Curl_convert_... prototypes */ #include "formdata.h" +#include "curl_rand.h" #include "strequal.h" #include "curl_memory.h" @@ -1763,24 +1758,3 @@ char *Curl_FormBoundary(void) } #endif /* !defined(CURL_DISABLE_HTTP) || defined(USE_SSLEAY) */ - -/* Pseudo-random number support. This is always enabled, since called from - curl_global_init(). */ - -unsigned int Curl_rand(void) -{ - unsigned int r; - /* Return an unsigned 32-bit pseudo-random number. */ - r = randseed = randseed * 1103515245 + 12345; - return (r << 16) | ((r >> 16) & 0xFFFF); -} - -void Curl_srand(void) -{ - /* Randomize pseudo-random number sequence. */ - - randseed = (unsigned int) time(NULL); - Curl_rand(); - Curl_rand(); - Curl_rand(); -} -- cgit v1.2.3