mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
[cppcheck] don't use rand_r
POSIX 2008 marks it as obsolete. Found with rand_rCalled Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
parent
fdb2837bc7
commit
c3cb44cd22
1 changed files with 2 additions and 1 deletions
|
@ -398,7 +398,8 @@ void history_impl_t::save_unless_disabled() {
|
|||
if (countdown_to_vacuum < 0) {
|
||||
unsigned int seed = static_cast<unsigned int>(time(nullptr));
|
||||
// Generate a number in the range [0, kVacuumFrequency).
|
||||
countdown_to_vacuum = rand_r(&seed) / (RAND_MAX / kVacuumFrequency + 1);
|
||||
srand(seed);
|
||||
countdown_to_vacuum = rand() / (RAND_MAX / kVacuumFrequency + 1);
|
||||
}
|
||||
|
||||
// Determine if we're going to vacuum.
|
||||
|
|
Loading…
Reference in a new issue