diff options
| author | Paul Eggert | 2012-07-05 11:35:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-05 11:35:48 -0700 |
| commit | 38182d901d030c7d65f4aa7a49b583afb30eb9b7 (patch) | |
| tree | a69e1a571495d6ca1c034359d7c995639774ab9b /src/eval.c | |
| parent | 6dd5a677dbf794eedaa8325c46d57ac041373361 (diff) | |
| download | emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.tar.gz emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.zip | |
More xmalloc and related cleanup.
* alloc.c, bidi.c, buffer.c, buffer.h, bytecode.c, callint.c:
* callproc.c, charset.c, coding.c, composite.c, data.c, dispnew.c:
* doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, fns.c:
* font.c, fontset.c, frame.c, fringe.c, ftfont.c, ftxfont.c, gmalloc.c:
* gtkutil.c, image.c, keyboard.c, keymap.c, lread.c, macros.c, menu.c:
* nsfns.m, nsfont.m, nsmenu.m, nsterm.m, print.c, process.c, ralloc.c:
* regex.c, region-cache.c, scroll.c, search.c, sound.c, syntax.c:
* sysdep.c, term.c, termcap.c, unexmacosx.c, window.c, xdisp.c:
* xfaces.c, xfns.c, xftfont.c, xgselect.c, xmenu.c, xrdb.c, xselect.c:
* xterm.c:
Omit needless casts involving void * pointers and allocation.
Prefer "P = xmalloc (sizeof *P)" to "P = xmalloc (sizeof (TYPE_OF_P))",
as the former is more robust if P's type is changed.
Prefer xzalloc to xmalloc + memset 0.
Simplify malloc-or-realloc to realloc.
Don't worry about xmalloc returning a null pointer.
Prefer xstrdup to xmalloc + strcpy.
* editfns.c (Fmessage_box): Grow message_text by at least 80 when
growing it.
* keyboard.c (apply_modifiers_uncached): Prefer local array to
alloca of a constant.
Diffstat (limited to 'src/eval.c')
| -rw-r--r-- | src/eval.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c index d35b71530ac..9da9ec05cae 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -138,7 +138,7 @@ void | |||
| 138 | init_eval_once (void) | 138 | init_eval_once (void) |
| 139 | { | 139 | { |
| 140 | enum { size = 50 }; | 140 | enum { size = 50 }; |
| 141 | specpdl = xmalloc (size * sizeof (struct specbinding)); | 141 | specpdl = xmalloc (size * sizeof *specpdl); |
| 142 | specpdl_size = size; | 142 | specpdl_size = size; |
| 143 | specpdl_ptr = specpdl; | 143 | specpdl_ptr = specpdl; |
| 144 | /* Don't forget to update docs (lispref node "Local Variables"). */ | 144 | /* Don't forget to update docs (lispref node "Local Variables"). */ |
| @@ -2803,7 +2803,8 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2803 | { | 2803 | { |
| 2804 | if (XSUBR (fun)->max_args > numargs) | 2804 | if (XSUBR (fun)->max_args > numargs) |
| 2805 | { | 2805 | { |
| 2806 | internal_args = (Lisp_Object *) alloca (XSUBR (fun)->max_args * sizeof (Lisp_Object)); | 2806 | internal_args = alloca (XSUBR (fun)->max_args |
| 2807 | * sizeof *internal_args); | ||
| 2807 | memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object)); | 2808 | memcpy (internal_args, args + 1, numargs * sizeof (Lisp_Object)); |
| 2808 | for (i = numargs; i < XSUBR (fun)->max_args; i++) | 2809 | for (i = numargs; i < XSUBR (fun)->max_args; i++) |
| 2809 | internal_args[i] = Qnil; | 2810 | internal_args[i] = Qnil; |