[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 945a762: Fix emacs_re_safe_alloca calculation
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 945a762: Fix emacs_re_safe_alloca calculation |
Date: |
Wed, 3 Oct 2018 18:57:30 -0400 (EDT) |
branch: master
commit 945a7622326f7d93dd318f01d54f6bf23e0021cf
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Fix emacs_re_safe_alloca calculation
Problem and draft fix noted by Eli Zaretskii in:
https://lists.gnu.org/r/emacs-devel/2018-10/msg00022.html
* src/emacs.c (main): Fix arithmetic used in calculation
of emacs_re_safe_alloca.
---
src/emacs.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/emacs.c b/src/emacs.c
index b1c96d1..ddaaf3f 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -888,11 +888,11 @@ main (int argc, char **argv)
lim = newlim;
}
}
- /* If the stack is big enough, let regex-emacs.c more of it before
- falling back to heap allocation. */
- emacs_re_safe_alloca = max
- (min (lim - extra, SIZE_MAX) * (min_ratio / ratio),
- MAX_ALLOCA);
+ /* If the stack is big enough, let regex-emacs.c use more of it
+ before falling back to heap allocation. */
+ ptrdiff_t max_failures
+ = min (lim - extra, min (PTRDIFF_MAX, SIZE_MAX)) / ratio;
+ emacs_re_safe_alloca = max (max_failures * min_ratio, MAX_ALLOCA);
}
#endif /* HAVE_SETRLIMIT and RLIMIT_STACK and not CYGWIN */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 945a762: Fix emacs_re_safe_alloca calculation,
Paul Eggert <=