forked from DevSolar/pdclib
-
Notifications
You must be signed in to change notification settings - Fork 9
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
Add actual Win32 errno values and error strings #18
Merged
Merged
Changes from all commits
Commits
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.
nit: My man page says:
I'm not sure if this is a Linux libc thing or C spec thing, but it's weird that the error number is not included here. Or are these values from the MS libc? (I did not look at the mentioned tool and also did not check what
strerror
does when the error number isn't part of the array).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 C standard doesn't have that requirement, although I see the benefit. The "unknown error" message itself comes from the PDCLib tool itself.
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 feel like the tool should dump out
NULL
and then https://github.com/DevSolar/pdclib/blob/8e10fcf7fd3bac2c5640a86fa165e7fa8c411803/functions/string/strerror.c#L14 should be improved to handle those.Then it would be obvious which messages are from the OS which provided the
strerror
messages, and which ones are from pdclib. It would also save on binary size (also interesting for embedded platforms).(Actually it's a bit weird, that the tool generates an array, instead of a switch/case, to avoid large gaps in error numbers)
Wether the handler for unknown messages remains as is (constant string), or provides more context (could
sprintf()
a number and add new messages to a list at runtime) could be decided later then.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 mentioned this discussion upstream DevSolar#9
I'd like to wait at least for a response, considering this is a low-priority PR (or is it required for something?).
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.
Hey there... I tinkered a bit with a different approach that removes the "holes" in the array. But that means each entry needs to hold the errno value it refers to, as I can no longer use the array index for the lookup.
That means each of the entries gets sizeof( int ) wider, for saving one sizeof( char * ) per "hole" value... already a marginal saving. And then I need a bit more code for the lookup... long story short, the patched build was larger than the current one by roundabout 300 bytes for a release build. I don't think that is what you're looking for...?!?
A tarball with the patched sources is available at http://rootdirectory.ddns.net/static/pdclib_patch_strerror.tgz if you want to experiment with that version.