[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sc/source
Pedro Giffuni
pfg at apache.org
Wed Jun 1 00:08:30 UTC 2016
sc/source/core/tool/interpr1.cxx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
New commits:
commit af2fd81efa1b1ad6dbd0449dcfd0bd57ec0116a9
Author: Pedro Giffuni <pfg at apache.org>
Date: Tue May 31 23:25:11 2016 +0000
RAND(): Destroy the random pool after seeding.
We are using rtl_random() only for seeding, we can save some memory here.
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 4cfb963..a2fb2ee 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -1679,15 +1679,16 @@ void ScInterpreter::ScRandom()
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "sc", "pfg", "ScInterpreter::ScRandom" );
- static rtlRandomPool aPool = rtl_random_createPool();
static sal_Bool SqSeeded = sal_False;
static sal_uInt32 ScCNG, ScXS = 362436069;
// Seeding for the PRNG
if (SqSeeded == sal_False) {
+ rtlRandomPool aPool = rtl_random_createPool();
rtl_random_getBytes(aPool, &ScCNG, sizeof(ScCNG));
rtl_random_getBytes(aPool, &nScRandomQ,
sizeof(nScRandomQ[0]) * SCRANDOMQ_SIZE);
+ rtl_random_destroyPool(aPool);
SqSeeded = sal_True;
}
PushDouble(static_cast<double>(KISS) / SAL_MAX_UINT32);
More information about the Libreoffice-commits
mailing list