Skip to content

Comment for #26196. #26219

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

Merged
merged 2 commits into from
Jun 23, 2015
Merged

Comment for #26196. #26219

merged 2 commits into from
Jun 23, 2015

Conversation

Veedrac
Copy link
Contributor

@Veedrac Veedrac commented Jun 11, 2015

Fixes #26196.

Alternatively we could explicitly check and complain (eg. panic), but I don't see the value-add.

Fixes rust-lang#26196.

Alternatively we could explicitly check and complain (eg. panic), but I don't see the value-add.
@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @pcwalton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. The way Github handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@@ -311,6 +311,7 @@ impl ExactSizeIterator for Args {

impl Drop for Args {
fn drop(&mut self) {
// NULL-safe
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change this to something like:

Note that self.cur can be null (CommandLineToArgvW previously failed), but LocalFree ignores NULL pointers

@@ -321,6 +323,9 @@ pub fn args() -> Args {
let lpCmdLine = c::GetCommandLineW();
let szArgList = c::CommandLineToArgvW(lpCmdLine, &mut nArgs);

// szArcList can be NULL if CommandLinToArgvW failed,
// but in that case nArgs is 0 so we won't actually
// try to read a null pointer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs don't guarantee that nargs is 0 on error, not what I can find. Why not check for error and set nargs to zero in that case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is initialized to 0 and the function probably won't touch it in the error case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but to be safe you might not want to rely on a “probably”.

@alexcrichton
Copy link
Member

@bors: r+ 2148567

Thanks @Veedrac! Also feel free to ping a PR whenever it's updated, unfortunately github doesn't send out notifications on force pushes.

bors added a commit that referenced this pull request Jun 23, 2015
Fixes #26196.

Alternatively we could explicitly check and complain (eg. panic), but I don't see the value-add.
@bors
Copy link
Collaborator

bors commented Jun 23, 2015

⌛ Testing commit 2148567 with merge 55deea6...

@bors bors merged commit 2148567 into rust-lang:master Jun 23, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants