[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/5] grep: remove no-longer-used setrlimit code
From: |
Paul Eggert |
Subject: |
[PATCH 3/5] grep: remove no-longer-used setrlimit code |
Date: |
Thu, 01 Mar 2012 12:49:23 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120209 Thunderbird/10.0.1 |
This code has been unused and obsolescent ever since the regex
code stopped using the stack for large regular expressions.
* src/main.c [HAVE_SETRLIMIT]: Do not include <sys/time.h> or
or <sys/resource.h>; no longer needed.
(set_rlimits): Remove. All callers changed.
---
src/main.c | 38 --------------------------------------
1 files changed, 0 insertions(+), 38 deletions(-)
diff --git a/src/main.c b/src/main.c
index 6151cac..3c5f6dd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -21,10 +21,6 @@
#include <config.h>
#include <sys/types.h>
#include <sys/stat.h>
-#if defined HAVE_SETRLIMIT
-# include <sys/time.h>
-# include <sys/resource.h>
-#endif
#include "mbsupport.h"
#include <wchar.h>
#include <wctype.h>
@@ -1589,39 +1585,6 @@ setmatcher (char const *m)
}
}
-static void
-set_limits (void)
-{
-#if defined HAVE_SETRLIMIT && defined RLIMIT_STACK
- struct rlimit rlim;
-
- /* I think every platform needs to do this, so that regex.c
- doesn't oveflow the stack. The default value of
- `re_max_failures' is too large for some platforms: it needs
- more than 3MB-large stack.
-
- The test for HAVE_SETRLIMIT should go into `configure'. */
- if (!getrlimit (RLIMIT_STACK, &rlim))
- {
- long newlim;
- extern long int re_max_failures; /* from regex.c */
-
- /* Approximate the amount regex.c needs, plus some more. */
- newlim = re_max_failures * 2 * 20 * sizeof (char *);
- if (newlim > rlim.rlim_max)
- {
- newlim = rlim.rlim_max;
- re_max_failures = newlim / (2 * 20 * sizeof (char *));
- }
- if (rlim.rlim_cur < newlim)
- {
- rlim.rlim_cur = newlim;
- setrlimit (RLIMIT_STACK, &rlim);
- }
- }
-#endif
-}
-
/* Find the white-space-separated options specified by OPTIONS, and
using BUF to store copies of these options, set ARGV[0], ARGV[1],
etc. to the option copies. Return the number N of options found.
@@ -2197,7 +2160,6 @@ main (int argc, char **argv)
else
usage (EXIT_TROUBLE);
- set_limits ();
compile (keys, keycc);
free (keys);
--
1.7.6.5
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH 3/5] grep: remove no-longer-used setrlimit code,
Paul Eggert <=