diff options
| author | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-05 11:35:48 -0700 |
|---|---|---|
| committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-07-05 11:35:48 -0700 |
| commit | 38182d901d030c7d65f4aa7a49b583afb30eb9b7 (patch) | |
| tree | a69e1a571495d6ca1c034359d7c995639774ab9b /src/process.c | |
| parent | 6dd5a677dbf794eedaa8325c46d57ac041373361 (diff) | |
| download | emacs-38182d901d030c7d65f4aa7a49b583afb30eb9b7.tar.gz | |
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/process.c')
| -rw-r--r-- | src/process.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/process.c b/src/process.c index 3f329872c76..2cb9e8de15f 100644 --- a/src/process.c +++ b/src/process.c @@ -1365,7 +1365,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) val = Vcoding_system_for_read; if (NILP (val)) { - args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); + args2 = alloca ((nargs + 1) * sizeof *args2); args2[0] = Qstart_process; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; GCPRO2 (proc, current_dir); @@ -1384,7 +1384,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) { if (EQ (coding_systems, Qt)) { - args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); + args2 = alloca ((nargs + 1) * sizeof *args2); args2[0] = Qstart_process; for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; GCPRO2 (proc, current_dir); @@ -1478,7 +1478,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) /* Now that everything is encoded we can collect the strings into NEW_ARGV. */ - new_argv = (unsigned char **) alloca ((nargs - 1) * sizeof (char *)); + new_argv = alloca ((nargs - 1) * sizeof *new_argv); new_argv[nargs - 2] = 0; for (i = nargs - 2; i-- != 0; ) @@ -5037,7 +5037,7 @@ read_process_output (Lisp_Object proc, register int channel) ptrdiff_t count = SPECPDL_INDEX (); Lisp_Object odeactivate; - chars = (char *) alloca (carryover + readmax); + chars = alloca (carryover + readmax); if (carryover) /* See the comment above. */ memcpy (chars, SDATA (p->decoding_buf), carryover); @@ -7083,8 +7083,7 @@ setup_process_coding_systems (Lisp_Object process) return; if (!proc_decode_coding_system[inch]) - proc_decode_coding_system[inch] - = xmalloc (sizeof (struct coding_system)); + proc_decode_coding_system[inch] = xmalloc (sizeof (struct coding_system)); coding_system = p->decode_coding_system; if (! NILP (p->filter)) ; @@ -7096,8 +7095,7 @@ setup_process_coding_systems (Lisp_Object process) setup_coding_system (coding_system, proc_decode_coding_system[inch]); if (!proc_encode_coding_system[outch]) - proc_encode_coding_system[outch] - = xmalloc (sizeof (struct coding_system)); + proc_encode_coding_system[outch] = xmalloc (sizeof (struct coding_system)); setup_coding_system (p->encode_coding_system, proc_encode_coding_system[outch]); #endif |
