-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added Kerne32Util method to facilitate checking that calls to LocalFree/GlobalFree are successful #606
Added Kerne32Util method to facilitate checking that calls to LocalFree/GlobalFree are successful #606
Conversation
4e0f939
to
abdd1f9
Compare
@@ -38,6 +38,7 @@ Features | |||
* [#589](https://github.com/java-native-access/jna/pull/589): Use MethodResultContext in direct mapping (as done in interface mapping) - [@marco2357](https://github.com/marco2357). | |||
* [#595](https://github.com/java-native-access/jna/pull/595): Allow calling COM methods/getters requiring hybrid calling (METHOD+PROPERTYGET) - [@matthiasblaesing](https://github.com/matthiasblaesing). | |||
* [#582](https://github.com/java-native-access/jna/pull/582): Mavenize the build process - Phase 1: building the native code via Maven [@lgoldstein](https://github.com/lgoldstein) | |||
* [#606](https://github.com/java-native-access/jna/pull/606): Added Kerne32Util method to facilitate checking that calls to LocalFree/GlobalFree are successful [@lgoldstein](https://github.com/lgoldstein) |
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 syntax of these is - [@name](link).
, mind fixing this one and the one above too please?
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.
Done.
I think that in the |
Normally, I would agree with you - but as you can see from my code changes, most people don't bother to check the return value or the error. By using this piece of code ourselves we give a good example as to the kind of coding standards we recommend. Furthermore, by providing these helper methods we make acceptance and usage of said standards more likely. Also, specifically for the version with the return code - 2 reasons to keep it (IMO):
|
…ee/GlobalFree are successful
abdd1f9
to
8855dc9
Compare
Added Kerne32Util method to facilitate checking that calls to LocalFree/GlobalFree are successful
Personally I still don't love having both |
I agree on this one, if someone wants an error code they can call GetLastError on their own. Just make
|
The code does not turn one error into another - it simply gives the programmer the choice to examine the returned error code and decide on another kind of handling rather than throwing an exception.
If you feel this strongly about this I will do it (as a separate PR). |
@lgoldstein Yes, you're right, it gives the programmer the choice to examine the returned error code. I fairly strongly feel that the programmer should not have that choice in a |
Very well then, I will publish a PR that adheres to this convention soon (unless you'd rather I do it directly on the master branch) |
Motivation: we are a bit behind of the current quiche HEAD. Modifications: Update to latest HEAD Result: Use latest quiche code
The current code calls Local/GlobalFree without checking that they succeeded.