comparison src/regex.c @ 8142:66a5487be3a7

Be less eager to define MATCH_MAY_ALLOCATE.
author Richard M. Stallman <rms@gnu.org>
date Tue, 05 Jul 1994 07:25:05 +0000
parents bebf92e1b110
children 694c4686b446
comparison
equal deleted inserted replaced
8141:e3859c43c6f4 8142:66a5487be3a7
896 using the relocating allocator routines, then malloc could cause a 896 using the relocating allocator routines, then malloc could cause a
897 relocation, which might (if the strings being searched are in the 897 relocation, which might (if the strings being searched are in the
898 ralloc heap) shift the data out from underneath the regexp 898 ralloc heap) shift the data out from underneath the regexp
899 routines. 899 routines.
900 900
901 Here's another reason to avoid allocation: Emacs insists on 901 Here's another reason to avoid allocation: Emacs
902 processing input from X in a signal handler; processing X input may 902 processes input from X in a signal handler; processing X input may
903 call malloc; if input arrives while a matching routine is calling 903 call malloc; if input arrives while a matching routine is calling
904 malloc, then we're scrod. But Emacs can't just block input while 904 malloc, then we're scrod. But Emacs can't just block input while
905 calling matching routines; then we don't notice interrupts when 905 calling matching routines; then we don't notice interrupts when
906 they come in. So, Emacs blocks input around all regexp calls 906 they come in. So, Emacs blocks input around all regexp calls
907 except the matching calls, which it leaves unprotected, in the 907 except the matching calls, which it leaves unprotected, in the
908 faith that they will not malloc. */ 908 faith that they will not malloc. */
909 909
910 /* Normally, this is fine. */ 910 /* Normally, this is fine. */
911 #define MATCH_MAY_ALLOCATE 911 #define MATCH_MAY_ALLOCATE
912 912
913 /* But under some circumstances, it's not. */ 913 /* The match routines may not allocate if (1) they would do it with malloc
914 #if defined (emacs) || (defined (REL_ALLOC) && defined (C_ALLOCA)) 914 and (2) it's not safe for htem to use malloc. */
915 #if (defined (C_ALLOCA) || defined (REGEX_MALLOC)) && (defined (emacs) || defined (REL_ALLOC))
915 #undef MATCH_MAY_ALLOCATE 916 #undef MATCH_MAY_ALLOCATE
916 #endif 917 #endif
917 918
918 919
919 /* Failure stack declarations and macros; both re_compile_fastmap and 920 /* Failure stack declarations and macros; both re_compile_fastmap and