On Wed, 2 Dec 2009, Cyril Brulebois wrote:
Firstly, strerror() is not
required to be reentrant by SUSv2 [0], which is the one and only
standard that lbzip2 is coded against. Secondly, incredible it might
seem, I even know about strerror_r(), and if you grep the source for
it, you'll find that I deliberately avoided it, since it first
appeared in SUSv3 [1]. I do call err2str() from multiple threads in
parallel. It's not nice but portable and gets the work done.
Then you might want to document this somewhere like in a comment around
that part of the code? That might lead people to think you actually got
a clue about what you're doing. "Logging utilities (that can be
called/accessed from multiple threads)" doesn't really tell anything
about SUSv2 vs. SUSv3.
1 /* $Id: main.h,v 1.12 2009/11/27 01:12:37 lacos Exp $ */
15 /* Utilities that can be called/accessed from multiple threads. */
27 /* (II) Logging utilities. */
35 /*
36 Return a static string corresponding to the error number.
strerror_r() is not
37 SUSv2.
38 */
39 const char *
40 err2str(int err);
It's an extern function and thus the comment is in the header.
I do try to justify stuff I feel non-obvious or expect it to appear
questionable. Please grep "SUSv" for examples if you feel like. Or scroll
through lbunzip2.c and look at all those comments where I (strive to)
prove stuff, mostly strictest thread notification conditions.
Incredible it might seem, there is a lot of shitty code in the
archive, assuming the worse is usually the way to go.
I don't debate that, I've had my own shocks looking at code I've randomly
downloaded from freshmeat. That's another reason why I try to be so
obsessively meticulous in my code, to avoid the semblance, even. I'll try
to be clearer in the future.
I'm sorry to have hurt your feelings.
I'm a whiner, sorry.
FWIW, the new version built just fine.
Cool :) I hope lbzip2 will be useful for you.
Cheers,
lacos
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]