Re: [PATCH 3/3] exterminate strtok - usr/gen_init_cpio.c

From: Paul Jackson
Date: Wed Aug 24 2005 - 23:47:10 EST


Horst wrote:
> > - if ('\n' == *type) {
> > + if (!*type || '\n' == *type) {
>
> Redundant. If *type == '\n', it is certainly != 0.

No - I don't think redundant, at least not this change in isolation.
Perhaps redundant in light of subsequent code lines, as Jesper notes in
his followup.

But it is confusing to read - poor and inconsistent choice of code
phrasing.

If the patch had read as:
- if (*type == '\n') {
+ if (*type == '\n' || *type == '\0') {

then it would be clearer to the reader in my view. A check for newline
is changed to a check for newline or nul-byte.

(Yes - I recognize that one is not given the freedom to change the
-old- lines in a patch for the sake of clarity ;).

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.925.600.0401
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/