[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

odd code in dbusbind.c

From: Tom Tromey
Subject: odd code in dbusbind.c
Date: Sat, 29 Dec 2007 15:41:19 -0700

While looking through dbusbind.c, I found a few oddities.

In Fdbus_register_signal:

  FUNCTIONP (handler);

In Fdbus_unregister_signal:

  /* Check parameter.  */
  CONSP (object) && (!NILP (XCAR (object))) && CONSP (XCDR (object));

I think each of these statements has no effect.  Presumably the author
meant to use one of the CHECK_* macros instead.

Also, I noticed that the XD_ macros, e.g., XD_ERROR, are braced
statements.  IMO it is idiomatic, and somewhat safer, to wrap things
like this in "do ... while (0)".  That way they can be safely used in
'if's (right now the code handles this by omitting ";"s where they
would interfere -- but this is subtle and easy to mess up).

As it is, the definition of XD_DEBUG_MESSAGE introduces some ambiguous
'else's in xd_retrieve_arg.  I think this is an actual bug.

xd_read_message declares a return type of Lisp_Object but never
returns a value.  Perhaps the return value is never used -- but IMO it
would be less weird to simply always return Qnil.

These little oddities can also be found by compiling with -Wall.  That
exposes other things, too... is there a particular reason not to be
"-Wall clean"?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]