diff options
author | Jochen Eisinger <c0ffee@irssi.org> | 2006-03-26 08:42:34 +0000 |
---|---|---|
committer | c0ffee <c0ffee@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2006-03-26 08:42:34 +0000 |
commit | 4de9baf8f1a4135128f3d40af7201e974107ac2f (patch) | |
tree | 6d7121baf9e2e370c353ec648e28c89a81fae0ff | |
parent | 47704b800d63248a339637d2625d628aa32f3191 (diff) | |
download | irssi-4de9baf8f1a4135128f3d40af7201e974107ac2f.zip |
Removed all srand calls and added a single srand invokation in at startup
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4264 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r-- | src/core/network.c | 2 | ||||
-rw-r--r-- | src/fe-none/irssi.c | 2 | ||||
-rw-r--r-- | src/fe-text/irssi.c | 2 | ||||
-rw-r--r-- | src/irc/bot/bot-users.c | 1 | ||||
-rw-r--r-- | src/irc/dcc/dcc-chat.c | 1 | ||||
-rw-r--r-- | src/irc/dcc/dcc-send.c | 1 |
6 files changed, 4 insertions, 5 deletions
diff --git a/src/core/network.c b/src/core/network.c index 8be0bd51..21235b2a 100644 --- a/src/core/network.c +++ b/src/core/network.c @@ -440,7 +440,6 @@ int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6) return HOST_NOT_FOUND; /* shouldn't happen? */ /* if there are multiple addresses, return random one */ - srand(time(NULL)); use_v4 = count_v4 <= 1 ? 0 : rand() % count_v4; use_v6 = count_v6 <= 1 ? 0 : rand() % count_v6; @@ -475,7 +474,6 @@ int net_gethostbyname(const char *addr, IPADDR *ip4, IPADDR *ip6) /* if there are multiple addresses, return random one */ ip4->family = AF_INET; - srand(time(NULL)); memcpy(&ip4->ip, hp->h_addr_list[rand() % count], 4); return 0; diff --git a/src/fe-none/irssi.c b/src/fe-none/irssi.c index eee24365..78442360 100644 --- a/src/fe-none/irssi.c +++ b/src/fe-none/irssi.c @@ -55,6 +55,8 @@ void noui_init(void) { NULL, '\0', 0, NULL } }; + srand(time(NULL)); + autoload_module = NULL; args_register(options); diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c index e685608f..878e397b 100644 --- a/src/fe-text/irssi.c +++ b/src/fe-text/irssi.c @@ -336,6 +336,8 @@ int main(int argc, char **argv) g_mem_set_vtable(&gc_mem_table); #endif + srand(time(NULL)); + dummy = FALSE; quitting = FALSE; core_init_paths(argc, argv); diff --git a/src/irc/bot/bot-users.c b/src/irc/bot/bot-users.c index 6c7a16e0..f9f6eae7 100644 --- a/src/irc/bot/bot-users.c +++ b/src/irc/bot/bot-users.c @@ -331,7 +331,6 @@ void botuser_set_password(USER_REC *user, const char *password) g_return_if_fail(user != NULL); g_return_if_fail(password != NULL); - srand(time(NULL)); salt[0] = rand()%20 + 'A'; salt[1] = rand()%20 + 'A'; salt[2] = '\0'; diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c index 58272d8a..bb44d4f2 100644 --- a/src/irc/dcc/dcc-chat.c +++ b/src/irc/dcc/dcc-chat.c @@ -515,7 +515,6 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server) signal_emit("dcc request send", 1, dcc); /* generate a random id */ - srand(time(NULL)); p_id = rand() % 64; dcc->pasv_id = p_id; diff --git a/src/irc/dcc/dcc-send.c b/src/irc/dcc/dcc-send.c index 4c72b761..14d7d1e6 100644 --- a/src/irc/dcc/dcc-send.c +++ b/src/irc/dcc/dcc-send.c @@ -438,7 +438,6 @@ static int dcc_send_one_file(int queue, const char *target, const char *fname, /* Generate an ID for this send if using passive protocol */ if (passive) { - srand(time(NULL)); dcc->pasv_id = rand() % 64; } |