Re: seperator error in __mask_snprintf_len

From: Paul Jackson
Date: Mon Jan 12 2004 - 16:45:30 EST


A couple of questions on your proposed patch for __mask_snprintf_len()
in lib/mask.c:

1) Why make the MASK_CHUNKSZ a possible (compile time) variable?
I can think of a couple good reasons why not to:
a] So long as we have the current format, in which each word
is _not_ zero filled, then the chunk size needs to be a
well known constant, or else the output is ambiguous.
For example, an output of "1,0" is ambiguous unless we know
a priori that the "0" stands for exactly 32, say, bits.
b] Even if we change to a zero filled format, better to just
always use the same chunk size, as that is one less detail
to confuse user level code.
I don't see any reason offhand for needing code that works with
more than one chunk size.
2) Why the trailing "buf[len++] = 0"? Won't the last snprintf do
as much?
3) This code has quite a bit more detail of bit shifts, masks and
arithmetic than before. Perhaps some is necessary to fix the
word order bug I had, perhaps some is only needed to allow for
the chunk size to vary. I'll take a shot at seeing if I can
find a less detail-rich expression of this that still gets the
word order correct.

--
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <pj@xxxxxxx> 1.650.933.1373
-
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/