-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error handling #13
Merged
Merged
Error handling #13
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
97bb961
fix possible memory leak (issue #8) and improve error handling
osch 3a8cced
fix typo in testcase
osch acbf9fc
throw lua error on malloc failures instead calling assert
osch adf832f
improved error message
osch 271ab5e
refactored function "from_lua_rectangle2" to "from_lua_rectangle_list…
osch 362f4d4
check for rectangle integer coordinates under Lua5.3
osch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm... With Lua 5.3,
luaL_checkinteger
does more thanlua_isnumber
, because 5.5 is a number, but not an integer. Butlua_isinteger
only exists in Lua 5.3 and not in older Lua versions.How about something like this:
One could also check if the number is an integer in older Lua versions instead of silently truncating, but I am not sure if that is worth it...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Lua 5.1 documentation for
luaL_checkinteger
differs from the Lua 5.3 documentation:Lua 5.1
Lua 5.3
So if the documentation is true there was already a silent truncation of numbers to integers before my changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I incorporated
oocairo_lua_isinteger
as you suggested, see my latest commit.