Repository navigation
ls: drop the dead code and the shadowed name - #202
Merged
Merged
Conversation
Follow-up to the previous commit, after reading the notice list rather than filtering it. Behaviour is unchanged and the 49 case comparison against GNU is still 39 of them. - `natural_compare` held its shared part count in a local called `max`. That is the same shadowing that made six helpers in `format_long.v` uncompilable once `max` came from `math` instead of being a builtin, and it is called as a function two lines away. It is `shared` now. - The same function walked a three valued `enum State` to record one bit, so it is a `bool` now. Starting it `false` is what keeps a leading run of digits from emitting an empty first part, which is why the initial state was neither of the two real ones. - Its comment restated the function name. It now says what -v actually changes. - `format_long.v` had a local called `checksum` shadowing the `checksum` function, an unused `statistics` function that nothing called, and an unused `options` parameter on `format_octal_permissions`. Gone. - `icons.v` and `table.v` carried two unused constants and an unused border function. They were part of the extras, but dead is dead and leaving four notices in every build helps nobody. `v fmt -verify .` passes, `v run build.vsh` builds all 76, `v test .` reports 49 of 49, and `src/ls` now builds with no notices at all.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #201, from reading the notice list instead of filtering it.
Behaviour is unchanged.
natural_compareheld its shared part count in a local calledmax. That isthe same shadowing that made six helpers in
format_long.vuncompilable oncemaxcame from a module instead of being a builtin, and it is called as afunction two lines away. It is
sharednow.enum Stateto record one bit, so itis a
boolnow. Starting itfalseis what keeps a leading run of digitsfrom emitting an empty first part, which is why the initial state was neither
of the two real ones.
-vchanges.format_long.vhad a local calledchecksumshadowing thechecksumfunction, an unused
statisticsfunction that nothing called, and an unusedoptionsparameter onformat_octal_permissions. Gone.icons.vandtable.vcarried two unused constants and an unused borderfunction. They are part of the non-GNU extras, but dead is dead, and four
notices in every build helps nobody.
v fmt -verify .passes,v run build.vshbuilds all 76,v test .reports 49of 49, and
src/lsnow builds with no notices at all.