diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2000-06-20 16:48:05 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2000-06-20 16:48:05 +0000 |
commit | a60198e5df719794ef91398c16062de790ff0602 (patch) | |
tree | abe786508885a163ce6322b1001d0e9a51adffbb /src/regex.c | |
parent | 4d5d60c34d3670b8f01035f90ebacd440da87878 (diff) | |
download | emacs-a60198e5df719794ef91398c16062de790ff0602.tar.gz emacs-a60198e5df719794ef91398c16062de790ff0602.tar.bz2 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/regex.c')
-rw-r--r-- | src/regex.c | 13 |
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) { int result = re_match_2_internal (bufp, NULL, 0, string, size, pos, regs, size); +#if defined (C_ALLOCA) && !defined (REGEX_MALLOC) alloca (0); +#endif return result; } #endif /* not emacs */ @@ -4335,7 +4337,9 @@ re_match_2 (bufp, string1, size1, string2, size2, pos, regs, stop) result = re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop); +#if defined (C_ALLOCA) && !defined (REGEX_MALLOC) alloca (0); +#endif return result; } @@ -5593,7 +5597,8 @@ re_comp (s) if (!s) { if (!re_comp_buf.buffer) - return gettext ("No previous regular expression"); + /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ + return (char *) gettext ("No previous regular expression"); return 0; } @@ -5601,12 +5606,14 @@ re_comp (s) { re_comp_buf.buffer = (unsigned char *) malloc (200); if (re_comp_buf.buffer == NULL) - return gettext (re_error_msgid[(int) REG_ESPACE]); + /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ + return (char *) gettext (re_error_msgid[(int) REG_ESPACE]); re_comp_buf.allocated = 200; re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH); if (re_comp_buf.fastmap == NULL) - return gettext (re_error_msgid[(int) REG_ESPACE]); + /* Yes, we're discarding `const' here if !HAVE_LIBINTL. */ + return (char *) gettext (re_error_msgid[(int) REG_ESPACE]); } /* Since `re_exec' always passes NULL for the `regs' argument, we |