[libsoup/gtimeval-out: 3/3] SoupMultipart: remove usage of GTimeVal and g_get_current_time()



commit b9c8a3019e808ef0408663e7fa3a7f9bad033413
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 a hash of the current time via GDateTime instead.

 libsoup/soup-multipart.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/libsoup/soup-multipart.c b/libsoup/soup-multipart.c
index 242c632f..f2c9562a 100644
--- a/libsoup/soup-multipart.c
+++ b/libsoup/soup-multipart.c
@@ -62,17 +62,21 @@ static char *
 generate_boundary (void)
 {
        static int counter;
+       GDateTime *datetime;
+
        struct {
-               GTimeVal timeval;
+               guint hash;
                int counter;
        } data;
 
        /* avoid valgrind warning */
-       if (sizeof (data) != sizeof (data.timeval) + sizeof (data.counter))
+       if (sizeof (data) != sizeof (data.hash) + sizeof (data.counter))
                memset (&data, 0, sizeof (data));
 
-       g_get_current_time (&data.timeval);
+       datetime = g_date_time_new_now_local ();
+       data.hash = g_date_time_hash (datetime);
        data.counter = counter++;
+       g_date_time_unref (datetime);
 
        /* 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]