Commit Graph

81 Commits

Author SHA1 Message Date
Roberto Ierusalimschy 0acd55898d Added gcc option '-Wconversion'
No warnings for standard numerical types. Still pending alternative
numerical types.
2024-07-27 13:32:59 -03:00
Roberto Ierusalimschy a08d82eb13 llimits.h being used by all Lua code
The definitions in llimits.h are useful not only for the core. That
header only defines types and '#define's, so libs and core still do
not share any real code/data.
2024-06-20 14:46:06 -03:00
Roberto Ierusalimschy bb7bb5944c More disciplined use of 'errno'
Set errno to zero before calling any function where we may use its
errno, and check errno for zero before using it (as functions may not
set it even in error). The code assumes that no function will put
garbage on errno (although ISO C allows that): If any function during an
operation set errno, and the operation result in an error, assume that
errno has something to say.
2024-06-12 15:50:31 -03:00
Roberto Ierusalimschy 5e08b41567 Simpler definition for LUA_STRFTIMEOPTIONS
There is no need for those intermediate definitions.
2023-02-07 10:48:39 -03:00
Roberto Ierusalimschy cf08915d62 New macro LUA_USE_IOS
Do not try to detect automatically whether system is iOS; it is
simpler and more reliable to let the programmer inform that.
2023-02-02 13:43:41 -03:00
Roberto Ierusalimschy d69789da1c Fix absence of 'system' in iOS
Despite claiming to be ISO, the C library in some Apple platforms
does not implement 'system'.
2023-01-24 15:04:17 -03:00
Roberto Ierusalimschy cfbe378f90 Small simplification in overflow check in 'getfield'
Subtracting a small non-negative int from a non-negative int cannot
overflow, and adding a non-negative int to INT_MIN cannot overflow.
2022-09-23 10:57:35 -03:00
Roberto Ierusalimschy 59c88f846d Broadening the use of branch hints
More uses of macros 'likely'/'unlikely' (renamed to
'l_likely'/'l_unlikely'), both in range (extended to the
libraries) and in scope (extended to hooks, stack growth).
2021-02-24 11:14:44 -03:00
Roberto Ierusalimschy efcf24be0c 'luaL_execresult' does not assume -1 status as error
ISO C is silent about the return of 'system'. Windows sets 'errno' in
case of errors. Linux has several different error cases, with different
return values. ISO C allows 'system' to set 'errno' even if there are no
errors. Here we assume that a status==0 is success (which is the case
on several platforms), otherwise it is an error. If there is an error
number, gives the error based on it. (The worst a spurious 'errno'
can do is to generate a bad error message.) Otherwise uses the normal
results.
2020-05-22 15:39:29 -03:00
Roberto Ierusalimschy 0ddc0f47bd Several details about 5.4.0 rc1
Corrected several small details: added 'const', adjusts in tabs x
spaces, removed unused #includes and #defines, misspellings, etc.
2020-04-23 14:48:15 -03:00
Roberto Ierusalimschy bd1b87c579 Comments (mosty typos) 2019-12-30 11:45:08 -03:00
Roberto Ierusalimschy 0eb6aa4013 Some improvements in date/time functions
- Range in date table extended to full 32 bits.
- Easier support for times represented as floats.
- Added more tests.
2019-07-24 15:01:59 -03:00
Roberto Ierusalimschy 2fc6b55dae Removed resource-related "emergency collections"
New to-be-closed variables is a better way to ensure the proper release
of resources.
2018-10-31 16:25:29 -03:00
Roberto Ierusalimschy 3d838f635c Added "emergency collection" to 'io.tmpfile' and 'os.tmpname'
These operations also can give errors for lack of resources, so they
also will try "emergency collections" in case of resource errors.
Because there are now two libraries with that kind of handling,
'resourcetryagain' was moved to the auxiliary library to be shared
by the libraries.
2018-07-27 15:50:53 -03:00
Roberto Ierusalimschy e885dee5ab File operations try an "emergency collection" when failing
If a file operation fails do to lack of resources (too many open
files or not enough memory), it does a full garbage collection and
tries the operation again. Lack of resources are "too many open
files" (process wise and system wise) and "not enough memory".
The code is full of '#if's because error codes are not part
of the standard ISO C.
2018-07-25 11:44:46 -03:00
Roberto Ierusalimschy 1a1b2f3d7f added 'return' to calls to 'luaL_error' (to signal to the compiler
that the function cannot continue past that call)
2017-03-14 09:40:44 -03:00
Roberto Ierusalimschy de96e26afc bug: 'checkoption' could read past end of string + 'os.date' can
handle embedded zeros
2016-07-18 14:58:58 -03:00
Roberto Ierusalimschy 48baa5e89c 'os.time(t)' normalizes 't' fields 2016-04-18 10:06:55 -03:00
Roberto Ierusalimschy 5f3ad5731e simpler yet definition for 'checkoption' 2016-02-09 10:16:11 -02:00
Roberto Ierusalimschy 494e9ba0f4 simpler code for 'checkoption' + added conversion specifiers specific
to Windows
2016-02-08 12:42:46 -02:00
Roberto Ierusalimschy 9945253d57 details (comments + text of error messages) 2016-01-06 11:43:05 -02:00
Roberto Ierusalimschy d103312661 details (typos in comments) 2015-11-19 17:16:22 -02:00
Roberto Ierusalimschy 403e181d81 'strftime' puts its result directly into 'lua_Buffer' 2015-07-06 12:16:51 -03:00
Roberto Ierusalimschy 4af03c5ae1 better treatment for integer overflows + all errors throw an error
(instead of returning nil)
2015-07-04 13:35:14 -03:00
Roberto Ierusalimschy 0d4a1f71db re-organization of initial configuration options 2015-04-10 14:41:04 -03:00
Roberto Ierusalimschy 0705e7b39f detail (no need to write 'double' in source) 2015-02-09 15:41:54 -02:00
Roberto Ierusalimschy f31cc8e342 typo in error message 2015-01-12 17:32:32 -02:00
Roberto Ierusalimschy 900bdd5761 detail (to avoid warnings) 2014-12-26 12:46:07 -02:00
Roberto Ierusalimschy 81ecaf6178 new specifiers in 'strftime' are defined in C99 (not Posix) 2014-12-10 13:42:42 -02:00
Roberto Ierusalimschy e75c0148c3 comments (references to "ANSI C" changed to "ISO C", which is the
international name
2014-11-02 17:33:33 -02:00
Roberto Ierusalimschy 28fdbcf393 added include for 'lprefix.h', for stuff that must be added before
any other header file
2014-11-02 17:19:04 -02:00
Roberto Ierusalimschy bdf566a8a3 `name' in comments changed to 'name' 2014-10-25 09:50:46 -02:00
Roberto Ierusalimschy f97c64d7bf macros 'LUA_QL'/'LUA_QL' deprecated 2014-10-17 13:28:21 -03:00
Roberto Ierusalimschy 65ec3379b1 added some casts for the cases when lua_Number != double 2014-10-08 16:57:31 -03:00
Roberto Ierusalimschy 798660c9cd deprecated "cast macros" ('luaL_checkint', 'luaL_optint', etc.) 2014-10-01 08:54:56 -03:00
Roberto Ierusalimschy a0d4f0fc8a template for 'mkstemp' is configurable (via LUA_TMPNAMTEMPLATE) 2014-04-29 14:05:13 -03:00
Roberto Ierusalimschy 469daa16ee configuration for Lua type corresponding to 'time_t' 2014-03-20 16:18:54 -03:00
Roberto Ierusalimschy a3addae036 lua_gettable and similars return type of gotten value 2014-03-12 17:57:40 -03:00
Roberto Ierusalimschy 986c11daa6 removal of weird construction in definition of LUA_STRFTIMEOPTIONS
(two empty strings concatenated as in "" "")
2014-02-26 12:55:58 -03:00
Roberto Ierusalimschy c6c41e85b2 more uniformity for defining system-dependent features 2014-02-26 12:27:56 -03:00
Roberto Ierusalimschy 4ad9970649 uses integers for time 2013-05-14 12:57:11 -03:00
Roberto Ierusalimschy bc84180d12 error message in 'os.rename' does not include file name, because error
may be caused both by 'fromname' or 'toname'
2012-10-19 12:54:02 -03:00
Roberto Ierusalimschy 054c20cd5b spaces -> tabs in #defines 2012-05-23 12:37:09 -03:00
Roberto Ierusalimschy 0f388193b3 'lUA' -> 'LUA' 2011-11-30 10:35:05 -02:00
Roberto Ierusalimschy 7948b8568e when available, use '*_r' versions of 'gmtime' and 'localtime' 2011-11-29 15:15:42 -02:00
Roberto Ierusalimschy 61b1d9a466 another try to avoid warnings about unreachable 'return' after 'exit' 2011-11-29 13:55:51 -02:00
Roberto Ierusalimschy 43f13729a2 comment 2011-06-20 13:50:59 -03:00
Roberto Ierusalimschy d806710ab5 returns for file-related functions and process-related functions
unified in 'auxlib'
2011-03-03 13:34:46 -03:00
Roberto Ierusalimschy c4ea0c3b29 detail (cleaning trailing spaces) 2011-01-26 14:30:02 -02:00
Roberto Ierusalimschy 8bc33a088c 'os.exit' acceps booleans as status (for EXIT_SUCESS and EXIT_FAILURE) 2010-10-05 09:18:03 -03:00