diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-04 16:40:18 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-04 16:40:18 -0300 |
commit | bfcf06d91a87b7ffb8c83e290db0cb6176a167f8 (patch) | |
tree | 0bcba905a2772e536c845e39e9eeed0c7330312c /testes/locals.lua | |
parent | 0280407fc54f9b6225139c5ac27326f98f0cf043 (diff) | |
download | lua-bfcf06d91a87b7ffb8c83e290db0cb6176a167f8.tar.gz lua-bfcf06d91a87b7ffb8c83e290db0cb6176a167f8.tar.bz2 lua-bfcf06d91a87b7ffb8c83e290db0cb6176a167f8.zip |
Avoid memory allocation in some functions from 'ltests.c'
To allow their use in memory tests, some functions in 'ltests.c'
should never allocate memory. To avoid this allocation, the
library registers the strings used for status codes, and keeps
the variable '_WARN' always defined (with false instead of nil).
Diffstat (limited to 'testes/locals.lua')
-rw-r--r-- | testes/locals.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/testes/locals.lua b/testes/locals.lua index 0e5e0c74..f5e96244 100644 --- a/testes/locals.lua +++ b/testes/locals.lua | |||
@@ -337,7 +337,7 @@ local function endwarn () | |||
337 | if not T then | 337 | if not T then |
338 | warn("@on") -- back to normal | 338 | warn("@on") -- back to normal |
339 | else | 339 | else |
340 | assert(_WARN == nil) | 340 | assert(_WARN == false) |
341 | warn("@normal") | 341 | warn("@normal") |
342 | end | 342 | end |
343 | end | 343 | end |
@@ -346,7 +346,7 @@ end | |||
346 | local function checkwarn (msg) | 346 | local function checkwarn (msg) |
347 | if T then | 347 | if T then |
348 | assert(string.find(_WARN, msg)) | 348 | assert(string.find(_WARN, msg)) |
349 | _WARN = nil -- reset variable to check next warning | 349 | _WARN = false -- reset variable to check next warning |
350 | end | 350 | end |
351 | end | 351 | end |
352 | 352 | ||