unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Strange code in emacs.c
@ 2018-10-03 15:15 Eli Zaretskii
  2018-10-03 17:36 ` Paul Eggert
  2018-10-03 22:12 ` Noam Postavsky
  0 siblings, 2 replies; 6+ messages in thread
From: Eli Zaretskii @ 2018-10-03 15:15 UTC (permalink / raw)
  To: Noam Postavsky; +Cc: emacs-devel

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-10-03 22:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-03 15:15 Strange code in emacs.c Eli Zaretskii
2018-10-03 17:36 ` 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

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).