changeset 643:d6792ccefe2f

Use ANSI C srand/rand() instead of POSIX srandom/random().
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Jan 2015 20:09:32 +0200
parents c8e5949a8961
children f5ec01370185
files main.c
diffstat 1 files changed, 2 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/main.c	Wed Jan 07 16:56:54 2015 +0200
+++ b/main.c	Wed Jan 07 20:09:32 2015 +0200
@@ -13,8 +13,6 @@
 #ifdef __WIN32
 #include <shlwapi.h>
 #include <shfolder.h>
-#define srandom srand
-#define random rand
 #else
 #include <sys/wait.h>
 #include <sys/stat.h>
@@ -2303,7 +2301,7 @@
     
     // Initialize random numbers
     editState.prevKeepAlive = time(NULL);
-    srandom((int) editState.prevKeepAlive);
+    srand((int) editState.prevKeepAlive);
 
     // Enter mainloop
     th_conn_reset(conn);
@@ -2359,7 +2357,7 @@
             time_t tmpTime = time(NULL);
             if (tmpTime - editState.prevKeepAlive > SET_KEEPALIVE)
             {
-                size_t n = ((size_t) random()) % th_llist_length(setIdleMessages);
+                size_t n = ((size_t) rand()) % th_llist_length(setIdleMessages);
                 qlist_t *node = th_llist_get_nth(setIdleMessages, n);
                 nn_conn_send_msg(conn, optUserNameEnc, node->data);
                 editState.prevKeepAlive = tmpTime;