diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 57 |
1 files changed, 43 insertions, 14 deletions
diff --git a/src/alloc.c b/src/alloc.c index 5377b27e329..3d8b7a54d06 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2811,6 +2811,38 @@ list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, L | |||
| 2811 | Fcons (arg5, Qnil))))); | 2811 | Fcons (arg5, Qnil))))); |
| 2812 | } | 2812 | } |
| 2813 | 2813 | ||
| 2814 | /* Make a list of COUNT Lisp_Objects, where ARG is the | ||
| 2815 | first one. Allocate conses from pure space if TYPE | ||
| 2816 | is PURE, or allocate as usual if type is HEAP. */ | ||
| 2817 | |||
| 2818 | Lisp_Object | ||
| 2819 | listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...) | ||
| 2820 | { | ||
| 2821 | va_list ap; | ||
| 2822 | ptrdiff_t i; | ||
| 2823 | Lisp_Object val, *objp; | ||
| 2824 | |||
| 2825 | /* Change to SAFE_ALLOCA if you hit this eassert. */ | ||
| 2826 | eassert (count <= MAX_ALLOCA / sizeof (Lisp_Object)); | ||
| 2827 | |||
| 2828 | objp = alloca (count * sizeof (Lisp_Object)); | ||
| 2829 | objp[0] = arg; | ||
| 2830 | va_start (ap, arg); | ||
| 2831 | for (i = 1; i < count; i++) | ||
| 2832 | objp[i] = va_arg (ap, Lisp_Object); | ||
| 2833 | va_end (ap); | ||
| 2834 | |||
| 2835 | for (i = 0, val = Qnil; i < count; i++) | ||
| 2836 | { | ||
| 2837 | if (type == PURE) | ||
| 2838 | val = pure_cons (objp[i], val); | ||
| 2839 | else if (type == HEAP) | ||
| 2840 | val = Fcons (objp[i], val); | ||
| 2841 | else | ||
| 2842 | abort (); | ||
| 2843 | } | ||
| 2844 | return val; | ||
| 2845 | } | ||
| 2814 | 2846 | ||
| 2815 | DEFUN ("list", Flist, Slist, 0, MANY, 0, | 2847 | DEFUN ("list", Flist, Slist, 0, MANY, 0, |
| 2816 | doc: /* Return a newly created list with specified arguments as elements. | 2848 | doc: /* Return a newly created list with specified arguments as elements. |
| @@ -6649,18 +6681,15 @@ Frames, windows, buffers, and subprocesses count as vectors | |||
| 6649 | (but the contents of a buffer's text do not count here). */) | 6681 | (but the contents of a buffer's text do not count here). */) |
| 6650 | (void) | 6682 | (void) |
| 6651 | { | 6683 | { |
| 6652 | Lisp_Object consed[8]; | 6684 | return listn (HEAP, 8, |
| 6653 | 6685 | bounded_number (cons_cells_consed), | |
| 6654 | consed[0] = bounded_number (cons_cells_consed); | 6686 | bounded_number (floats_consed), |
| 6655 | consed[1] = bounded_number (floats_consed); | 6687 | bounded_number (vector_cells_consed), |
| 6656 | consed[2] = bounded_number (vector_cells_consed); | 6688 | bounded_number (symbols_consed), |
| 6657 | consed[3] = bounded_number (symbols_consed); | 6689 | bounded_number (string_chars_consed), |
| 6658 | consed[4] = bounded_number (string_chars_consed); | 6690 | bounded_number (misc_objects_consed), |
| 6659 | consed[5] = bounded_number (misc_objects_consed); | 6691 | bounded_number (intervals_consed), |
| 6660 | consed[6] = bounded_number (intervals_consed); | 6692 | bounded_number (strings_consed)); |
| 6661 | consed[7] = bounded_number (strings_consed); | ||
| 6662 | |||
| 6663 | return Flist (8, consed); | ||
| 6664 | } | 6693 | } |
| 6665 | 6694 | ||
| 6666 | /* Find at most FIND_MAX symbols which have OBJ as their value or | 6695 | /* Find at most FIND_MAX symbols which have OBJ as their value or |
| @@ -6841,8 +6870,8 @@ do hash-consing of the objects allocated to pure space. */); | |||
| 6841 | /* We build this in advance because if we wait until we need it, we might | 6870 | /* We build this in advance because if we wait until we need it, we might |
| 6842 | not be able to allocate the memory to hold it. */ | 6871 | not be able to allocate the memory to hold it. */ |
| 6843 | Vmemory_signal_data | 6872 | Vmemory_signal_data |
| 6844 | = pure_cons (Qerror, | 6873 | = listn (PURE, 2, Qerror, |
| 6845 | pure_cons (build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs"), Qnil)); | 6874 | build_pure_c_string ("Memory exhausted--use M-x save-some-buffers then exit and restart Emacs")); |
| 6846 | 6875 | ||
| 6847 | DEFVAR_LISP ("memory-full", Vmemory_full, | 6876 | DEFVAR_LISP ("memory-full", Vmemory_full, |
| 6848 | doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); | 6877 | doc: /* Non-nil means Emacs cannot get much more Lisp memory. */); |