diff options
| author | Roland McGrath | 1992-10-15 23:29:28 +0000 |
|---|---|---|
| committer | Roland McGrath | 1992-10-15 23:29:28 +0000 |
| commit | fd0654667e6844ad235e5c2647960f778ce724c7 (patch) | |
| tree | e10f8b8bd2b55d4b7b7cfc7c29f972ee0be17a59 /src | |
| parent | 4e7d5543d9421a3699af78abd5859bfddec79552 (diff) | |
| download | emacs-fd0654667e6844ad235e5c2647960f778ce724c7.tar.gz emacs-fd0654667e6844ad235e5c2647960f778ce724c7.zip | |
(morecore_with_warning): Removed.
(check_memory_limits): New fn; most code from morecore_with_warning, but
only checks limits, doesn't do any work.
(memory_warnings): Set __after_morecore_hook to check_memory_limits;
don't set __morecore.
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm-limit.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/vm-limit.c b/src/vm-limit.c index ea99ebdae9b..c3bd98d67de 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c | |||
| @@ -44,13 +44,10 @@ static int warnlevel; | |||
| 44 | 0 means don't issue them. */ | 44 | 0 means don't issue them. */ |
| 45 | static void (*warn_function) (); | 45 | static void (*warn_function) (); |
| 46 | 46 | ||
| 47 | extern POINTER sbrk (); | ||
| 48 | |||
| 49 | /* Get more memory space, complaining if we're near the end. */ | 47 | /* Get more memory space, complaining if we're near the end. */ |
| 50 | 48 | ||
| 51 | static POINTER | 49 | static void |
| 52 | morecore_with_warning (size) | 50 | check_memory_limits () |
| 53 | register int size; | ||
| 54 | { | 51 | { |
| 55 | POINTER result; | 52 | POINTER result; |
| 56 | register POINTER cp; | 53 | register POINTER cp; |
| @@ -62,7 +59,7 @@ morecore_with_warning (size) | |||
| 62 | five_percent = lim_data / 20; | 59 | five_percent = lim_data / 20; |
| 63 | 60 | ||
| 64 | /* Find current end of memory and issue warning if getting near max */ | 61 | /* Find current end of memory and issue warning if getting near max */ |
| 65 | cp = sbrk (0); | 62 | cp = (char *) (*__morecore) (0); |
| 66 | data_size = (char *) cp - (char *) data_space_start; | 63 | data_size = (char *) cp - (char *) data_space_start; |
| 67 | 64 | ||
| 68 | if (warn_function) | 65 | if (warn_function) |
| @@ -112,11 +109,6 @@ morecore_with_warning (size) | |||
| 112 | 109 | ||
| 113 | if (EXCEEDS_LISP_PTR (cp)) | 110 | if (EXCEEDS_LISP_PTR (cp)) |
| 114 | (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); | 111 | (*warn_function) ("Warning: memory in use exceeds lisp pointer size"); |
| 115 | |||
| 116 | result = sbrk (size); | ||
| 117 | if (result == (POINTER) -1) | ||
| 118 | return NULL; | ||
| 119 | return result; | ||
| 120 | } | 112 | } |
| 121 | 113 | ||
| 122 | /* Cause reinitialization based on job parameters; | 114 | /* Cause reinitialization based on job parameters; |
| @@ -127,7 +119,7 @@ memory_warnings (start, warnfun) | |||
| 127 | POINTER start; | 119 | POINTER start; |
| 128 | void (*warnfun) (); | 120 | void (*warnfun) (); |
| 129 | { | 121 | { |
| 130 | extern POINTER (* __morecore) (); /* From gmalloc.c */ | 122 | extern void (* __after_morecore_hook) (); /* From gmalloc.c */ |
| 131 | 123 | ||
| 132 | if (start) | 124 | if (start) |
| 133 | data_space_start = start; | 125 | data_space_start = start; |
| @@ -135,5 +127,5 @@ memory_warnings (start, warnfun) | |||
| 135 | data_space_start = start_of_data (); | 127 | data_space_start = start_of_data (); |
| 136 | 128 | ||
| 137 | warn_function = warnfun; | 129 | warn_function = warnfun; |
| 138 | __morecore = &morecore_with_warning; | 130 | __after_morecore_hook = check_memory_limits; |
| 139 | } | 131 | } |