diff options
| author | Stefan Monnier | 2011-03-31 00:24:03 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2011-03-31 00:24:03 -0400 |
| commit | 40d83b412f584cc02e68d4eac8fd5e6eb769e2fe (patch) | |
| tree | b56f27a7e6d75a8c1fd27b00179a27b5efea0a32 /src/alloc.c | |
| parent | f488fb6528738131ef41859e1f04125f2e50efce (diff) | |
| parent | 44f230aa043ebb222aa0876b44d70484d5dd38db (diff) | |
| download | emacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.tar.gz emacs-40d83b412f584cc02e68d4eac8fd5e6eb769e2fe.zip | |
Merge from trunk
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/src/alloc.c b/src/alloc.c index 0ca702fe0cd..07f1caae46b 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -254,8 +254,10 @@ const char *pending_malloc_warning; | |||
| 254 | 254 | ||
| 255 | /* Buffer in which we save a copy of the C stack at each GC. */ | 255 | /* Buffer in which we save a copy of the C stack at each GC. */ |
| 256 | 256 | ||
| 257 | #if MAX_SAVE_STACK > 0 | ||
| 257 | static char *stack_copy; | 258 | static char *stack_copy; |
| 258 | static int stack_copy_size; | 259 | static size_t stack_copy_size; |
| 260 | #endif | ||
| 259 | 261 | ||
| 260 | /* Non-zero means ignore malloc warnings. Set during initialization. | 262 | /* Non-zero means ignore malloc warnings. Set during initialization. |
| 261 | Currently not used. */ | 263 | Currently not used. */ |
| @@ -2705,7 +2707,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0, | |||
| 2705 | doc: /* Return a newly created list with specified arguments as elements. | 2707 | doc: /* Return a newly created list with specified arguments as elements. |
| 2706 | Any number of arguments, even zero arguments, are allowed. | 2708 | Any number of arguments, even zero arguments, are allowed. |
| 2707 | usage: (list &rest OBJECTS) */) | 2709 | usage: (list &rest OBJECTS) */) |
| 2708 | (int nargs, register Lisp_Object *args) | 2710 | (size_t nargs, register Lisp_Object *args) |
| 2709 | { | 2711 | { |
| 2710 | register Lisp_Object val; | 2712 | register Lisp_Object val; |
| 2711 | val = Qnil; | 2713 | val = Qnil; |
| @@ -2921,10 +2923,10 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0, | |||
| 2921 | doc: /* Return a newly created vector with specified arguments as elements. | 2923 | doc: /* Return a newly created vector with specified arguments as elements. |
| 2922 | Any number of arguments, even zero arguments, are allowed. | 2924 | Any number of arguments, even zero arguments, are allowed. |
| 2923 | usage: (vector &rest OBJECTS) */) | 2925 | usage: (vector &rest OBJECTS) */) |
| 2924 | (register int nargs, Lisp_Object *args) | 2926 | (register size_t nargs, Lisp_Object *args) |
| 2925 | { | 2927 | { |
| 2926 | register Lisp_Object len, val; | 2928 | register Lisp_Object len, val; |
| 2927 | register int i; | 2929 | register size_t i; |
| 2928 | register struct Lisp_Vector *p; | 2930 | register struct Lisp_Vector *p; |
| 2929 | 2931 | ||
| 2930 | XSETFASTINT (len, nargs); | 2932 | XSETFASTINT (len, nargs); |
| @@ -2952,10 +2954,10 @@ argument to catch the left-over arguments. If such an integer is used, the | |||
| 2952 | arguments will not be dynamically bound but will be instead pushed on the | 2954 | arguments will not be dynamically bound but will be instead pushed on the |
| 2953 | stack before executing the byte-code. | 2955 | stack before executing the byte-code. |
| 2954 | usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) | 2956 | usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */) |
| 2955 | (register int nargs, Lisp_Object *args) | 2957 | (register size_t nargs, Lisp_Object *args) |
| 2956 | { | 2958 | { |
| 2957 | register Lisp_Object len, val; | 2959 | register Lisp_Object len, val; |
| 2958 | register int i; | 2960 | register size_t i; |
| 2959 | register struct Lisp_Vector *p; | 2961 | register struct Lisp_Vector *p; |
| 2960 | 2962 | ||
| 2961 | XSETFASTINT (len, nargs); | 2963 | XSETFASTINT (len, nargs); |
| @@ -4238,7 +4240,7 @@ static void | |||
| 4238 | check_gcpros (void) | 4240 | check_gcpros (void) |
| 4239 | { | 4241 | { |
| 4240 | struct gcpro *p; | 4242 | struct gcpro *p; |
| 4241 | int i; | 4243 | size_t i; |
| 4242 | 4244 | ||
| 4243 | for (p = gcprolist; p; p = p->next) | 4245 | for (p = gcprolist; p; p = p->next) |
| 4244 | for (i = 0; i < p->nvars; ++i) | 4246 | for (i = 0; i < p->nvars; ++i) |
| @@ -4847,7 +4849,7 @@ returns nil, because real GC can't be done. */) | |||
| 4847 | { | 4849 | { |
| 4848 | register struct specbinding *bind; | 4850 | register struct specbinding *bind; |
| 4849 | char stack_top_variable; | 4851 | char stack_top_variable; |
| 4850 | register int i; | 4852 | register size_t i; |
| 4851 | int message_p; | 4853 | int message_p; |
| 4852 | Lisp_Object total[8]; | 4854 | Lisp_Object total[8]; |
| 4853 | int count = SPECPDL_INDEX (); | 4855 | int count = SPECPDL_INDEX (); |
| @@ -4913,21 +4915,26 @@ returns nil, because real GC can't be done. */) | |||
| 4913 | #if MAX_SAVE_STACK > 0 | 4915 | #if MAX_SAVE_STACK > 0 |
| 4914 | if (NILP (Vpurify_flag)) | 4916 | if (NILP (Vpurify_flag)) |
| 4915 | { | 4917 | { |
| 4916 | i = &stack_top_variable - stack_bottom; | 4918 | char *stack; |
| 4917 | if (i < 0) i = -i; | 4919 | size_t stack_size; |
| 4918 | if (i < MAX_SAVE_STACK) | 4920 | if (&stack_top_variable < stack_bottom) |
| 4919 | { | 4921 | { |
| 4920 | if (stack_copy == 0) | 4922 | stack = &stack_top_variable; |
| 4921 | stack_copy = (char *) xmalloc (stack_copy_size = i); | 4923 | stack_size = stack_bottom - &stack_top_variable; |
| 4922 | else if (stack_copy_size < i) | 4924 | } |
| 4923 | stack_copy = (char *) xrealloc (stack_copy, (stack_copy_size = i)); | 4925 | else |
| 4924 | if (stack_copy) | 4926 | { |
| 4927 | stack = stack_bottom; | ||
| 4928 | stack_size = &stack_top_variable - stack_bottom; | ||
| 4929 | } | ||
| 4930 | if (stack_size <= MAX_SAVE_STACK) | ||
| 4931 | { | ||
| 4932 | if (stack_copy_size < stack_size) | ||
| 4925 | { | 4933 | { |
| 4926 | if ((EMACS_INT) (&stack_top_variable - stack_bottom) > 0) | 4934 | stack_copy = (char *) xrealloc (stack_copy, stack_size); |
| 4927 | memcpy (stack_copy, stack_bottom, i); | 4935 | stack_copy_size = stack_size; |
| 4928 | else | ||
| 4929 | memcpy (stack_copy, &stack_top_variable, i); | ||
| 4930 | } | 4936 | } |
| 4937 | memcpy (stack_copy, stack, stack_size); | ||
| 4931 | } | 4938 | } |
| 4932 | } | 4939 | } |
| 4933 | #endif /* MAX_SAVE_STACK > 0 */ | 4940 | #endif /* MAX_SAVE_STACK > 0 */ |