Skip to content

improve converting strings to ints/longs#3579

Closed
krader1961 wants to merge 3 commits into
fish-shell:masterfrom
krader1961:wcstoi
Closed

improve converting strings to ints/longs#3579
krader1961 wants to merge 3 commits into
fish-shell:masterfrom
krader1961:wcstoi

Conversation

@krader1961
Copy link
Copy Markdown
Contributor

The existing code is inconsistent, and in a couple of cases wrong, about
dealing with strings that are not valid ints. For example, there are
locations that call wcstol() and check errno without first setting errno
to zero. Normalize the code to a consistent pattern.

This does make some syntax more liberal. For example echo $PATH[1 .. 3]
is now valid due to uniformly allowing leading and trailing whitespace
around numbers. Whereas prior to this change you would get a "Invalid
index value" error. Contrast this with echo $PATH[ 1.. 3 ] which was
valid and still is.

Kurtis Rader added 3 commits November 23, 2016 20:21
The existing code is inconsistent, and in a couple of cases wrong, about
dealing with strings that are not valid ints. For example, there are
locations that call wcstol() and check errno without first setting errno
to zero. Normalize the code to a consistent pattern.

This does make some syntax more liberal. For example `echo $PATH[1 .. 3]`
is now valid due to uniformly allowing leading and trailing whitespace
around numbers. Whereas prior to this change you would get a "Invalid
index value" error. Contrast this with `echo $PATH[ 1.. 3 ]` which was
valid and still is.
@krader1961
Copy link
Copy Markdown
Contributor Author

Squash merged as commit a928517.

@faho faho added enhancement release notes Something that is or should be mentioned in the release notes labels Dec 2, 2016
@zanchey zanchey added this to the fish 2.5.0 milestone Dec 3, 2016
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement release notes Something that is or should be mentioned in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants