mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-17 19:30:38 -08:00
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.
This commit is contained in:
parent
6dd5a677db
commit
38182d901d
61 changed files with 379 additions and 441 deletions
|
|
@ -1145,8 +1145,8 @@ coding_alloc_by_realloc (struct coding_system *coding, ptrdiff_t bytes)
|
|||
{
|
||||
if (STRING_BYTES_BOUND - coding->dst_bytes < bytes)
|
||||
string_overflow ();
|
||||
coding->destination = (unsigned char *) xrealloc (coding->destination,
|
||||
coding->dst_bytes + bytes);
|
||||
coding->destination = xrealloc (coding->destination,
|
||||
coding->dst_bytes + bytes);
|
||||
coding->dst_bytes += bytes;
|
||||
}
|
||||
|
||||
|
|
@ -7010,7 +7010,7 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
|
|||
coding->charbuf = NULL; \
|
||||
while (size > 1024) \
|
||||
{ \
|
||||
coding->charbuf = (int *) alloca (sizeof (int) * size); \
|
||||
coding->charbuf = alloca (sizeof (int) * size); \
|
||||
if (coding->charbuf) \
|
||||
break; \
|
||||
size >>= 1; \
|
||||
|
|
@ -9568,7 +9568,7 @@ make_subsidiaries (Lisp_Object base)
|
|||
{
|
||||
Lisp_Object subsidiaries;
|
||||
ptrdiff_t base_name_len = SBYTES (SYMBOL_NAME (base));
|
||||
char *buf = (char *) alloca (base_name_len + 6);
|
||||
char *buf = alloca (base_name_len + 6);
|
||||
int i;
|
||||
|
||||
memcpy (buf, SDATA (SYMBOL_NAME (base)), base_name_len);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue