From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.devel Subject: odd code in dbusbind.c Date: Sat, 29 Dec 2007 15:41:19 -0700 Message-ID: Reply-To: Tom Tromey NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1198969846 17222 80.91.229.12 (29 Dec 2007 23:10:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 29 Dec 2007 23:10:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 30 00:11:01 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1J8kpY-00030g-FW for ged-emacs-devel@m.gmane.org; Sun, 30 Dec 2007 00:11:00 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J8kpD-0005ob-7O for ged-emacs-devel@m.gmane.org; Sat, 29 Dec 2007 18:10:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J8kp9-0005o7-Eb for emacs-devel@gnu.org; Sat, 29 Dec 2007 18:10:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J8kp6-0005nk-Rh for emacs-devel@gnu.org; Sat, 29 Dec 2007 18:10:35 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J8kp6-0005nh-OL for emacs-devel@gnu.org; Sat, 29 Dec 2007 18:10:32 -0500 Original-Received: from mx1.redhat.com ([66.187.233.31]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J8kp6-000320-Ax for emacs-devel@gnu.org; Sat, 29 Dec 2007 18:10:32 -0500 Original-Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id lBTNAVLh019695 for ; Sat, 29 Dec 2007 18:10:32 -0500 Original-Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [10.11.255.20]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lBTNAVkI017542 for ; Sat, 29 Dec 2007 18:10:31 -0500 Original-Received: from opsy.redhat.com (ton.yyz.redhat.com [10.15.16.15]) by pobox.corp.redhat.com (8.13.1/8.13.1) with ESMTP id lBTNAVJR030506; Sat, 29 Dec 2007 18:10:31 -0500 Original-Received: by opsy.redhat.com (Postfix, from userid 500) id 1F47CC8803B; Sat, 29 Dec 2007 15:41:19 -0700 (MST) X-Attribution: Tom X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:85643 Archived-At: 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