aboutsummaryrefslogtreecommitdiff
path: root/lib/formdata.c
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2009-09-17 14:23:27 +0000
committerYang Tse <yangsita@gmail.com>2009-09-17 14:23:27 +0000
commitf2f45339dc378ed4d15b19ebf8d16e9f58d776e8 (patch)
treea9656262c646f1d8e35084d8bad29f0ec4db3f73 /lib/formdata.c
parentbe5c815f630f47fb9d9d520f526c24a902862db5 (diff)
Moved Curl_rand() and Curl_srand() code from formdata.c and formdata.h
into curl_rand.c and curl_rand.h
Diffstat (limited to 'lib/formdata.c')
-rw-r--r--lib/formdata.c28
1 files changed, 1 insertions, 27 deletions
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 <stdio.h>
@@ -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();
-}