summaryrefslogtreecommitdiff
path: root/src/regex.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1993-06-10 12:50:56 +0000
committerJim Blandy <jimb@redhat.com>1993-06-10 12:50:56 +0000
commit85be31013c1b4dc8d624d051f6156dafcd336d36 (patch)
treef0041e581d495bd307adc687936a102f360cd98e /src/regex.c
parentada464a7f3ffe0213d412196a14d9bb02e3531cb (diff)
downloademacs-85be31013c1b4dc8d624d051f6156dafcd336d36.tar.gz
*** empty log message ***
Diffstat (limited to 'src/regex.c')
-rw-r--r--src/regex.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/regex.c b/src/regex.c
index 4bb30f7e214..06c1bb0b72e 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -881,13 +881,22 @@ static const char *re_error_msg[] =
using the relocating allocator routines, then malloc could cause a
relocation, which might (if the strings being searched are in the
ralloc heap) shift the data out from underneath the regexp
- routines. */
+ routines.
+
+ Here's another reason to avoid allocation: Emacs insists on
+ processing input from X in a signal handler; processing X input may
+ call malloc; if input arrives while a matching routine is calling
+ malloc, then we're scrod. But Emacs can't just block input while
+ calling matching routines; then we don't notice interrupts when
+ they come in. So, Emacs blocks input around all regexp calls
+ except the matching calls, which it leaves unprotected, in the
+ faith that they will not malloc. */
/* Normally, this is fine. */
#define MATCH_MAY_ALLOCATE
/* But under some circumstances, it's not. */
-#if defined (REL_ALLOC) && defined (C_ALLOCA)
+#if defined (emacs) || (defined (REL_ALLOC) && defined (C_ALLOCA))
#undef MATCH_MAY_ALLOCATE
#endif