<<< Date Index >>>     <<< Thread Index >>>

Re: Little code cleanup



On 2008-03-06 08:54:03 -0500, Derek Martin wrote:
> My earlier comments aside, I agree that the patch should be applied.
> I don't think it makes sense to write code that compiles with
> warnings,

Yes, but they are other ways to avoid warnings. As I've said, the
real bug is in gcc. Fortunately, gcc is rather inconsistent with
itself (that's not surprising with bugs), and avoiding the warning
concerning the NONULL macro is quite easy. :)

For instance:

diff -r 9a7d802004d3 lib.h
--- a/lib.h     Sun Mar 02 21:45:53 2008 -0800
+++ b/lib.h     Fri Mar 07 15:50:51 2008 +0100
@@ -75,7 +75,7 @@
 
 
 # define FREE(x) safe_free(x)
-# define NONULL(x) x?x:""
+# define NONULL(x) ((x) != (void *) 0) ? (x) : ""
 # define ISSPACE(c) isspace((unsigned char)c)
 # define strfcpy(A,B,C) strncpy(A,B,C), *(A+(C)-1)=0
 

Now, it's true that some tests are not really useful. But the above
change could be needed if some functions were implemented as macros.

Concerning the line

    if (isSpool && mbox && *mbox)

in mx.c, other parts of the code (including what's in the "if") assume
that mbox is an array. So, if it is decided to change mbox into a
dynamical buffer, other parts of the code will break, and the mbox
test is rather useless.

-- 
Vincent Lefèvre <vincent@xxxxxxxxxx> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)