From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Schwab Newsgroups: gmane.emacs.devel Subject: Re: Lisp watchpoints Date: Sun, 29 Nov 2015 12:28:59 +0100 Message-ID: <87bnadjb7o.fsf@igel.home> References: <83wpt922dn.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1448797331 30114 80.91.229.3 (29 Nov 2015 11:42:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 29 Nov 2015 11:42:11 +0000 (UTC) Cc: John Wiegley , Eli Zaretskii , Stefan Monnier , emacs-devel@gnu.org To: Noam Postavsky Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Nov 29 12:42:04 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1a30Ml-0004il-Jn for ged-emacs-devel@m.gmane.org; Sun, 29 Nov 2015 12:42:03 +0100 Original-Received: from localhost ([::1]:35801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a30AI-0007xz-K4 for ged-emacs-devel@m.gmane.org; Sun, 29 Nov 2015 06:29:10 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54854) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a30AE-0007xE-SW for emacs-devel@gnu.org; Sun, 29 Nov 2015 06:29:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a30AE-000202-3b for emacs-devel@gnu.org; Sun, 29 Nov 2015 06:29:06 -0500 Original-Received: from mail-out.m-online.net ([2001:a60:0:28:0:1:25:1]:47609) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a30AA-0001uV-8k; Sun, 29 Nov 2015 06:29:02 -0500 Original-Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3p7nWx3q7Wz3hkVM; Sun, 29 Nov 2015 12:29:01 +0100 (CET) Original-Received: from localhost (dynscan1.mnet-online.de [192.168.6.68]) by mail.m-online.net (Postfix) with ESMTP id 3p7nWx2hCwzvdWw; Sun, 29 Nov 2015 12:29:01 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Original-Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.68]) (amavisd-new, port 10024) with ESMTP id jNcVi-VYk9zF; Sun, 29 Nov 2015 12:29:00 +0100 (CET) X-Auth-Info: 2pFM/6WT/c74/gRJpSzE9IwNZ2iqxsZ9ju79pM2SvRM5/dSoHuvLmFyAheW7Zfr3 Original-Received: from igel.home (ppp-88-217-11-199.dynamic.mnet-online.de [88.217.11.199]) by mail.mnet-online.de (Postfix) with ESMTPA; Sun, 29 Nov 2015 12:29:00 +0100 (CET) Original-Received: by igel.home (Postfix, from userid 1000) id CE81C2C2491; Sun, 29 Nov 2015 12:28:59 +0100 (CET) X-Yow: Uh-oh!! I forgot to submit to COMPULSORY URINALYSIS! In-Reply-To: (Noam Postavsky's message of "Sun, 29 Nov 2015 00:12:16 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 2001:a60:0:28:0:1:25:1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:195516 Archived-At: Noam Postavsky writes: > On Sat, Nov 28, 2015 at 11:44 PM, Stefan Monnier > wrote: >>> + while (!NILP (watchers)) >>> + { >>> + Lisp_Object watcher = XCAR (watchers); >> >> This will lead to a segmentation fault after something like (put >> 'watchers [1]). While very unlikely, it's very easy to avoid this >> problem: just use CONSP instead of !NILP. >> >>> + else if (FUNCTIONP (watcher)) >>> + CALLN (Ffuncall, watcher, operation, where, symbol, newval); >> >> I don't think you need to test "FUNCTIONP (watcher)". > > Isn't the FUNCTIONP test needed for basically the same reason as using > CONSP over !NILP? i.e. to avoid segfault in case of (put > 'watchers '([1])). Ffuncall does all necessary checks. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."