From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Strange code in emacs.c Date: Wed, 03 Oct 2018 20:42:59 +0300 Message-ID: <83d0sr2afw.fsf@gnu.org> References: <83h8i32ha8.fsf@gnu.org> <28cf3cf7-8be2-9f6b-711d-bfbd2b625936@cs.ucla.edu> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1538588513 10358 195.159.176.226 (3 Oct 2018 17:41:53 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 3 Oct 2018 17:41:53 +0000 (UTC) Cc: npostavs@gmail.com, emacs-devel@gnu.org To: Paul Eggert Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 03 19:41:49 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g7l9g-0002bb-WD for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2018 19:41:49 +0200 Original-Received: from localhost ([::1]:51278 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7lBn-0006iy-K0 for ged-emacs-devel@m.gmane.org; Wed, 03 Oct 2018 13:43:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7lB4-0006c1-8C for emacs-devel@gnu.org; Wed, 03 Oct 2018 13:43:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g7lB0-0001et-EZ for emacs-devel@gnu.org; Wed, 03 Oct 2018 13:43:14 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g7lAz-0001e5-39; Wed, 03 Oct 2018 13:43:10 -0400 Original-Received: from [176.228.60.248] (port=4008 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g7lAx-00043d-A2; Wed, 03 Oct 2018 13:43:09 -0400 In-reply-to: <28cf3cf7-8be2-9f6b-711d-bfbd2b625936@cs.ucla.edu> (message from Paul Eggert on Wed, 3 Oct 2018 10:36:35 -0700) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:230208 Archived-At: > Cc: emacs-devel@gnu.org > From: Paul Eggert > Date: Wed, 3 Oct 2018 10:36:35 -0700 > > > Don't we mean to set emacs_re_safe_alloca like this instead: > > > > emacs_re_safe_alloca = min (lim - extra, SIZE_MAX) / ratio; > > emacs_re_safe_alloca = max (emacs_re_safe_alloca * min_ratio, MAX_ALLOCA); > > Yes, that sounds better to me too. Also, that SIZE_MAX should be changed to min > (SIZE_MAX, PTRDIFF_MAX) to avoid (unlikely) integer-overflow issues. OK, will do. > Should this fix be put into master or into the emacs-26 branch? It's a bit scary to do this on emacs-26, as the effect is a dramatic increase in stack usage by regex routines on most platforms. So I thought about doing this on master. But I'm eager to be convinced by good arguments to the contrary ;-)