all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Noam Postavsky <npostavs@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Strange code in emacs.c
Date: Wed, 03 Oct 2018 18:15:11 +0300	[thread overview]
Message-ID: <83h8i32ha8.fsf@gnu.org> (raw)

We have this in 'main':

      emacs_re_safe_alloca = max
        (min (lim - extra, SIZE_MAX) * (min_ratio / ratio),
         MAX_ALLOCA);

This always yields MAX_ALLOCA because 'ratio' is always greater than
'min_ratio':

      int min_ratio = 20 * sizeof (char *);
      int ratio = min_ratio + min_ratio / 3;

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);



             reply	other threads:[~2018-10-03 15:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-03 15:15 Eli Zaretskii [this message]
2018-10-03 17:36 ` Strange code in emacs.c Paul Eggert
2018-10-03 17:42   ` Eli Zaretskii
2018-10-03 18:29     ` Paul Eggert
2018-10-03 22:12 ` Noam Postavsky
2018-10-03 22:59   ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83h8i32ha8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.