fixdep: refactor parse_dep_file()
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 11 Jan 2018 13:05:45 +0000 (22:05 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 18 Jan 2018 00:37:39 +0000 (09:37 +0900)
commit87b95a81357dd6ec679a786cebfe34d0e797f752
tree4ff8959f557331f671428f59bc7a19e544be8708
parent5d1ef76f5a22ea07120671c5fcddafd365000cc9
fixdep: refactor parse_dep_file()

parse_dep_file() has too much indentation, and puts the code far to
the right.  This commit refactors the code and reduces the one level
of indentation.

strrcmp() computes 'slen' by itself, but the caller already knows the
length of the token, so 'slen' can be passed via function argument.
With this, we can swap the order of strrcmp() and "*p = \0;"

Also, strrcmp() is an ambiguous function name.  Flip the logic and
rename it to str_ends_with().

I added a new helper is_ignored_file() - this returns 1 if the token
represents a file that should be ignored.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
scripts/basic/fixdep.c