Skip to content

readline: remove intermediate variable#31676

Merged
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:positive
Feb 9, 2020
Merged

readline: remove intermediate variable#31676
cjihrig merged 1 commit into
nodejs:masterfrom
cjihrig:positive

Conversation

@cjihrig

@cjihrig cjihrig commented Feb 7, 2020

Copy link
Copy Markdown
Contributor

This commit removes an extra intermediate variable. This makes the call consistent with other uses of validateUint32() in the codebase.

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added the readline Issues and PRs related to the built-in readline module. label Feb 7, 2020

@BridgeAR BridgeAR left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I added the variable deliberately to indicate the meaning of it. It's otherwise not possible to know what true stands for. Instead of removing the variable, it's likely better to change other places to also indicate the passed through meaning.

@lpinca

lpinca commented Feb 7, 2020

Copy link
Copy Markdown
Member

It's otherwise not possible to know what true stands for

The reader needs to jump to validateUint32() definition, but it's there no?

@BridgeAR

BridgeAR commented Feb 9, 2020

Copy link
Copy Markdown
Member

@lpinca it's an indirection and IMO true and false are similar to magic numbers: ideally they are not used.

@nodejs-github-bot

nodejs-github-bot commented Feb 9, 2020

Copy link
Copy Markdown
Collaborator

@cjihrig cjihrig added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 9, 2020
This commit removes an extrea intermediate variable. This
makes the call consistent with other uses of validateUint32()
in the codebase.

PR-URL: nodejs#31676
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@cjihrig cjihrig merged commit efec681 into nodejs:master Feb 9, 2020
@cjihrig cjihrig deleted the positive branch February 9, 2020 16:07
@cjihrig

cjihrig commented Feb 9, 2020

Copy link
Copy Markdown
Contributor Author

It's not really feasible to replace all uses of true and false throughout the codebase, and there is nothing special about validateUint32() (in fact it's an internal API), so I've gone ahead and landed this.

codebytere pushed a commit that referenced this pull request Feb 17, 2020
This commit removes an extrea intermediate variable. This
makes the call consistent with other uses of validateUint32()
in the codebase.

PR-URL: #31676
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@codebytere codebytere mentioned this pull request Feb 17, 2020
@targos

targos commented Apr 18, 2020

Copy link
Copy Markdown
Member

depends on #31318 to land on v12.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. readline Issues and PRs related to the built-in readline module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants