aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2000-06-20 16:48:05 +0000
committerStefan Monnier2000-06-20 16:48:05 +0000
commita60198e5df719794ef91398c16062de790ff0602 (patch)
treeabe786508885a163ce6322b1001d0e9a51adffbb /src
parent4d5d60c34d3670b8f01035f90ebacd440da87878 (diff)
downloademacs-a60198e5df719794ef91398c16062de790ff0602.tar.gz
emacs-a60198e5df719794ef91398c16062de790ff0602.zip
(re_match, re_match_2): Protect calls to alloca (0).
(re_comp): Cast gettext return value to avoid complaints when !HAVE_LIBINTL.
Diffstat (limited to 'src')
-rw-r--r--src/regex.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/regex.c b/src/regex.c
index 2e06d0edeaf..1b796c08886 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -4291,7 +4291,9 @@ re_match (bufp, string, size, pos, regs)
4291{ 4291{
4292 int result = re_match_2_internal (bufp, NULL, 0, string, size, 4292 int result = re_match_2_internal (bufp, NULL, 0, string, size,
4293 pos, regs, size); 4293 pos, regs, size);
4294#if defined (C_ALLOCA) && !defined (REGEX_MALLOC)
4294 alloca (0); 4295 alloca (0);
4296#endif
4295 return result; 4297 return result;
4296} 4298}
4297#endif /* not emacs */ 4299#endif /* not emacs */
@@ -4335,7 +4337,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop)
4335 4337
4336 result = re_match_2_internal (bufp, string1, size1, string2, size2, 4338 result = re_match_2_internal (bufp, string1, size1, string2, size2,
4337 pos, regs, stop); 4339 pos, regs, stop);
4340#if defined (C_ALLOCA) && !defined (REGEX_MALLOC)
4338 alloca (0); 4341 alloca (0);
4342#endif
4339 return result; 4343 return result;
4340} 4344}
4341 4345
@@ -5593,7 +5597,8 @@ re_comp (s)
5593 if (!s) 5597 if (!s)
5594 { 5598 {
5595 if (!re_comp_buf.buffer) 5599 if (!re_comp_buf.buffer)
5596 return gettext ("No previous regular expression"); 5600 /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
5601 return (char *) gettext ("No previous regular expression");
5597 return 0; 5602 return 0;
5598 } 5603 }
5599 5604
@@ -5601,12 +5606,14 @@ re_comp (s)
5601 { 5606 {
5602 re_comp_buf.buffer = (unsigned char *) malloc (200); 5607 re_comp_buf.buffer = (unsigned char *) malloc (200);
5603 if (re_comp_buf.buffer == NULL) 5608 if (re_comp_buf.buffer == NULL)
5604 return gettext (re_error_msgid[(int) REG_ESPACE]); 5609 /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
5610 return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
5605 re_comp_buf.allocated = 200; 5611 re_comp_buf.allocated = 200;
5606 5612
5607 re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); 5613 re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH);
5608 if (re_comp_buf.fastmap == NULL) 5614 if (re_comp_buf.fastmap == NULL)
5609 return gettext (re_error_msgid[(int) REG_ESPACE]); 5615 /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */
5616 return (char *) gettext (re_error_msgid[(int) REG_ESPACE]);
5610 } 5617 }
5611 5618
5612 /* Since `re_exec' always passes NULL for the `regs' argument, we 5619 /* Since `re_exec' always passes NULL for the `regs' argument, we