[libsoup/gtimeval-out: 16/16] SoupMultipart: remove usage of GTimeVal and g_get_current_time()
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsoup/gtimeval-out: 16/16] SoupMultipart: remove usage of GTimeVal and g_get_current_time()
- Date: Wed, 21 Aug 2019 09:22:29 +0000 (UTC)
commit 214cf7b23f099b816cc825b5322b1bd112af45a5
Author: Claudio Saavedra <csaavedra igalia com>
Date: Tue Aug 13 15:22:46 2019 +0300
SoupMultipart: remove usage of GTimeVal and g_get_current_time()
Use an array of random integers instead, which is more than enough
to generate a random boundary.
libsoup/soup-multipart.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
---
diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
index 242c632f..a7e550f1 100644
--- a/libsoup/soup-multipart.c
+++ b/libsoup/soup-multipart.c
@@ -61,18 +61,10 @@ soup_multipart_new_internal (char *mime_type, char *boundary)
static char *
generate_boundary (void)
{
- static int counter;
- struct {
- GTimeVal timeval;
- int counter;
- } data;
-
- /* avoid valgrind warning */
- if (sizeof (data) != sizeof (data.timeval) + sizeof (data.counter))
- memset (&data, 0, sizeof (data));
-
- g_get_current_time (&data.timeval);
- data.counter = counter++;
+ guint32 data[2];
+
+ data[0] = g_random_int ();
+ data[1] = g_random_int ();
/* The maximum boundary string length is 69 characters, and a
* stringified SHA256 checksum is 64 bytes long.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]