unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* odd code in dbusbind.c
@ 2007-12-29 22:41 Tom Tromey
  2007-12-30 16:01 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Tromey @ 2007-12-29 22:41 UTC (permalink / raw)
  To: emacs-devel

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"?

Tom

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-12-31 10:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-29 22:41 odd code in dbusbind.c Tom Tromey
2007-12-30 16:01 ` Michael Albinus
2007-12-30 21:05   ` Tom Tromey
2007-12-31 10:29     ` Michael Albinus

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).