From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: 23.0.50; dbus Date: Tue, 01 Jan 2008 22:06:07 -0500 Message-ID: References: <87abod2b1x.fsf@gmx.de> <878x3umeo1.fsf@gmx.de> <87k5mufsl7.fsf@gmx.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1199243179 16455 80.91.229.12 (2 Jan 2008 03:06:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Jan 2008 03:06:19 +0000 (UTC) Cc: Peter Dyballa , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 02 04:06:37 2008 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 1J9twC-00015W-UI for ged-emacs-devel@m.gmane.org; Wed, 02 Jan 2008 04:06:37 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J9tvq-0005JJ-DB for ged-emacs-devel@m.gmane.org; Tue, 01 Jan 2008 22:06:14 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J9tvm-0005Fe-Sb for emacs-devel@gnu.org; Tue, 01 Jan 2008 22:06:10 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J9tvl-0005Br-5y for emacs-devel@gnu.org; Tue, 01 Jan 2008 22:06:10 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J9tvl-0005BX-0r for emacs-devel@gnu.org; Tue, 01 Jan 2008 22:06:09 -0500 Original-Received: from ironport2-out.pppoe.ca ([206.248.154.182]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1J9tvk-0004Zh-PD for emacs-devel@gnu.org; Tue, 01 Jan 2008 22:06:08 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAKOOekfO+IaddGdsb2JhbACQEQEwgSGUYA X-IronPort-AV: E=Sophos;i="4.24,231,1196658000"; d="scan'208";a="12172334" Original-Received: from smtp.pppoe.ca ([65.39.196.238]) by ironport2-out.pppoe.ca with ESMTP; 01 Jan 2008 22:06:07 -0500 Original-Received: from pastel.home ([206.248.134.157]) by smtp.pppoe.ca (Internet Mail Server v1.0) with ESMTP id IEI43707; Tue, 01 Jan 2008 22:06:07 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 1D3D384AE; Tue, 1 Jan 2008 22:06:06 -0500 (EST) In-Reply-To: <87k5mufsl7.fsf@gmx.de> (Michael Albinus's message of "Mon, 31 Dec 2007 22:43:32 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:85846 Archived-At: > Here I'm lost. I use something like > if (NILP (uname) || (strlen (SDATA (uname)) > 0)) > uname is a Lisp_Object. SDATA (uname) returns (char *). What kind of > signedness do I break in strlen? Does anybody have an idea? Someone else already answered the question, but I'll just take the opportunity to point out that the above code is a common small bug: the strlen may crash if uname is neither nil nor a string. A better way to write such code is if (STRINGP (uname) && (strlen (SDATA (uname)) > 0)) Another benefit is that the compiler can do a better job of eliminating the (now) redundant STRINGP test that may lurk inside SDATA. Stefan