From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#48264: [PATCH v4 12/14] Assert that PER_BUFFER_IDX for Lisp variables is not 0 Date: Fri, 7 May 2021 22:09:03 -0400 Message-ID: <20210508020905.13583-14-sbaugh@catern.com> References: <20210506213346.9730-1-sbaugh@catern.com> <20210508020905.13583-1-sbaugh@catern.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27449"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Spencer Baugh To: 48264@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat May 08 04:45:59 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lfCyd-00071N-Dr for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 08 May 2021 04:45:59 +0200 Original-Received: from localhost ([::1]:37124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lfCyc-0004Iu-D2 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 07 May 2021 22:45:58 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lfCPw-0001Pk-Mi for bug-gnu-emacs@gnu.org; Fri, 07 May 2021 22:10:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:35657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lfCPw-0007aD-BS for bug-gnu-emacs@gnu.org; Fri, 07 May 2021 22:10:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lfCPw-0006W1-7p for bug-gnu-emacs@gnu.org; Fri, 07 May 2021 22:10:08 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 May 2021 02:10:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48264 X-GNU-PR-Package: emacs Original-Received: via spool by 48264-submit@debbugs.gnu.org id=B48264.162043978824922 (code B ref 48264); Sat, 08 May 2021 02:10:08 +0000 Original-Received: (at 48264) by debbugs.gnu.org; 8 May 2021 02:09:48 +0000 Original-Received: from localhost ([127.0.0.1]:47187 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfCPb-0006Tp-Ud for submit@debbugs.gnu.org; Fri, 07 May 2021 22:09:48 -0400 Original-Received: from venus.catern.com ([68.183.49.163]:47956) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lfCPH-0006Sv-Ac for 48264@debbugs.gnu.org; Fri, 07 May 2021 22:09:42 -0400 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=98.7.229.235; helo=localhost; envelope-from=sbaugh@catern.com; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=catern.com; s=mail; t=1620439766; bh=ZE9Cwa8BBt02+uYxS7/iW4j7tc3H3sRNxIryYSbpCFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DsytQO6RH0JzG4/U6LTByt06dxenpWbS4VhmWYw3LaXUuQEiyaXlUDlkPW/7akKuD rwrwe758Gw6RxdIzF8oFCY6VdpGyXF38BUEJmsWvE7sljkvbJ/cFVB9Ja2741YWNdi 1NkK9BGQl4ODhMp8Nfot4A0I74vIl15G4Slf1DpY= Original-Received: from localhost (cpe-98-7-229-235.nyc.res.rr.com [98.7.229.235]) by venus.catern.com (Postfix) with ESMTPSA id A668F2E9834; Sat, 8 May 2021 02:09:26 +0000 (UTC) X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210508020905.13583-1-sbaugh@catern.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205973 Archived-At: PER_BUFFER_IDX can't be 0 for Lisp variables - so this if-check was always pointless. * src/data.c (default_value): Change if to eassert. --- src/data.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data.c b/src/data.c index 30f8523af8..758ff68d83 100644 --- a/src/data.c +++ b/src/data.c @@ -1758,8 +1758,8 @@ default_value (Lisp_Object symbol) if (BUFFER_OBJFWDP (valcontents)) { int offset = XBUFFER_OBJFWD (valcontents)->offset; - if (PER_BUFFER_IDX (offset) != 0) - return per_buffer_default (offset); + eassert (PER_BUFFER_IDX (offset) != 0); + return per_buffer_default (offset); } /* For other variables, get the current value. */ -- 2.31.1