lkml.org 
[lkml]   [2004]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: seperator error in __mask_snprintf_len
> MASK_CHUNKSZ is a named constant not a variable.  Once we pick a value
> it can never change. The specified legal values are for 1) varying to
> test for algorithmic correctness, and 2) giving the list of values from
> which we must pick the permanent value before too much more time goes by.

I can see where the testing for algorithmic correctness would be useful.

The final code should reflect the final choices.

> No. snprintf will fill to the end of the buffer and not place the

Correct - snprintf will not nul terminate if it runs out of buffer.

But then again, I wouldn't expect a "mask_snprintf" (such as might wrap
this __mask_snprintf_len() code) to guarantee nul termination in the
full buffer case either. Rather the caller has to watch for a returned
length that is too close to the length of the buffer, and handle it as
an error. If you look at the cpumask_snprintf() calls, they do just
this.

snprintf-like calls should behave like snprintf calls, no fancier.

> I am pretty sure the code is within a hairsbreadth of being minimal.

We'll see. I'm still poking at it.

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

\
 
 \ /
  Last update: 2005-03-22 14:00    [W:0.095 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site