Cleanup xmalloc.
* admin/coccinelle/xzalloc.cocci: Semantic patch to convert calls to xmalloc with following memset to xzalloc. * src/lisp.h (xzalloc): New prototype. Omit needless casts. * src/alloc.c (xzalloc): New function. Omit needless casts. * src/charset.c: Omit needless casts. Convert all calls to malloc with following memset to xzalloc. * src/dispnew.c: Likewise. * src/fringe.c: Likewise. * src/image.c: Likewise. * src/sound.c: Likewise. * src/term.c: Likewise. * src/w32fns.c: Likewise. * src/w32font.c: Likewise. * src/w32term.c: Likewise. * src/xfaces.c: Likewise. * src/xfns.c: Likewise. * src/xterm.c: Likewise. * src/atimer.c: Omit needless casts. * src/buffer.c: Likewise. * src/callproc.c: Likewise. * src/ccl.c: Likewise. * src/coding.c: Likewise. * src/composite.c: Likewise. * src/doc.c: Likewise. * src/doprnt.c: Likewise. * src/editfns.c: Likewise. * src/emacs.c: Likewise. * src/eval.c: Likewise. * src/filelock.c: Likewise. * src/fns.c: Likewise. * src/gtkutil.c: Likewise. * src/keyboard.c: Likewise. * src/lisp.h: Likewise. * src/lread.c: Likewise. * src/minibuf.c: Likewise. * src/msdos.c: Likewise. * src/print.c: Likewise. * src/process.c: Likewise. * src/region-cache.c: Likewise. * src/search.c: Likewise. * src/sysdep.c: Likewise. * src/termcap.c: Likewise. * src/terminal.c: Likewise. * src/tparam.c: Likewise. * src/w16select.c: Likewise. * src/w32.c: Likewise. * src/w32reg.c: Likewise. * src/w32select.c: Likewise. * src/w32uniscribe.c: Likewise. * src/widget.c: Likewise. * src/xdisp.c: Likewise. * src/xmenu.c: Likewise. * src/xrdb.c: Likewise. * src/xselect.c: Likewise.
This commit is contained in:
parent
0497dc44b4
commit
23f86fce48
53 changed files with 246 additions and 215 deletions
|
@ -1,3 +1,8 @@
|
|||
2012-07-05 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
* coccinelle/xzalloc.cocci: Semantic patch to convert
|
||||
calls to xmalloc with following memset to xzalloc.
|
||||
|
||||
2012-07-04 Juanma Barranquero <lekktu@gmail.com>
|
||||
|
||||
* CPP-DEFINES (LISP_FLOAT_TYPE): Remove, obsolete.
|
||||
|
|
10
admin/coccinelle/xzalloc.cocci
Normal file
10
admin/coccinelle/xzalloc.cocci
Normal file
|
@ -0,0 +1,10 @@
|
|||
@@
|
||||
expression x;
|
||||
expression E;
|
||||
@@
|
||||
x =
|
||||
- xmalloc
|
||||
+ xzalloc
|
||||
(E)
|
||||
...
|
||||
- memset (x, 0, E);
|
|
@ -1,3 +1,59 @@
|
|||
2012-07-05 Dmitry Antipov <dmantipov@yandex.ru>
|
||||
|
||||
Cleanup xmalloc.
|
||||
* lisp.h (xzalloc): New prototype. Omit needless casts.
|
||||
* alloc.c (xzalloc): New function. Omit needless casts.
|
||||
* charset.c: Omit needless casts. Convert all calls to
|
||||
xmalloc with following memset to xzalloc.
|
||||
* dispnew.c: Likewise.
|
||||
* fringe.c: Likewise.
|
||||
* image.c: Likewise.
|
||||
* sound.c: Likewise.
|
||||
* term.c: Likewise.
|
||||
* w32fns.c: Likewise.
|
||||
* w32font.c: Likewise.
|
||||
* w32term.c: Likewise.
|
||||
* xfaces.c: Likewise.
|
||||
* xfns.c: Likewise.
|
||||
* xterm.c: Likewise.
|
||||
* atimer.c: Omit needless casts.
|
||||
* buffer.c: Likewise.
|
||||
* callproc.c: Likewise.
|
||||
* ccl.c: Likewise.
|
||||
* coding.c: Likewise.
|
||||
* composite.c: Likewise.
|
||||
* doc.c: Likewise.
|
||||
* doprnt.c: Likewise.
|
||||
* editfns.c: Likewise.
|
||||
* emacs.c: Likewise.
|
||||
* eval.c: Likewise.
|
||||
* filelock.c: Likewise.
|
||||
* fns.c: Likewise.
|
||||
* gtkutil.c: Likewise.
|
||||
* keyboard.c: Likewise.
|
||||
* lisp.h: Likewise.
|
||||
* lread.c: Likewise.
|
||||
* minibuf.c: Likewise.
|
||||
* msdos.c: Likewise.
|
||||
* print.c: Likewise.
|
||||
* process.c: Likewise.
|
||||
* region-cache.c: Likewise.
|
||||
* search.c: Likewise.
|
||||
* sysdep.c: Likewise.
|
||||
* termcap.c: Likewise.
|
||||
* terminal.c: Likewise.
|
||||
* tparam.c: Likewise.
|
||||
* w16select.c: Likewise.
|
||||
* w32.c: Likewise.
|
||||
* w32reg.c: Likewise.
|
||||
* w32select.c: Likewise.
|
||||
* w32uniscribe.c: Likewise.
|
||||
* widget.c: Likewise.
|
||||
* xdisp.c: Likewise.
|
||||
* xmenu.c: Likewise.
|
||||
* xrdb.c: Likewise.
|
||||
* xselect.c: Likewise.
|
||||
|
||||
2012-07-05 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* fileio.c (time_error_value): Check the right error number.
|
||||
|
|
22
src/alloc.c
22
src/alloc.c
|
@ -735,6 +735,22 @@ xmalloc (size_t size)
|
|||
return val;
|
||||
}
|
||||
|
||||
/* Like the above, but zeroes out the memory just allocated. */
|
||||
|
||||
void *
|
||||
xzalloc (size_t size)
|
||||
{
|
||||
void *val;
|
||||
|
||||
MALLOC_BLOCK_INPUT;
|
||||
val = malloc (size);
|
||||
MALLOC_UNBLOCK_INPUT;
|
||||
|
||||
if (!val && size)
|
||||
memory_full (size);
|
||||
memset (val, 0, size);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* Like realloc but check for no memory and block interrupt input.. */
|
||||
|
||||
|
@ -867,7 +883,7 @@ char *
|
|||
xstrdup (const char *s)
|
||||
{
|
||||
size_t len = strlen (s) + 1;
|
||||
char *p = (char *) xmalloc (len);
|
||||
char *p = xmalloc (len);
|
||||
memcpy (p, s, len);
|
||||
return p;
|
||||
}
|
||||
|
@ -3881,7 +3897,7 @@ mem_insert (void *start, void *end, enum mem_type type)
|
|||
if (x == NULL)
|
||||
abort ();
|
||||
#else
|
||||
x = (struct mem_node *) xmalloc (sizeof *x);
|
||||
x = xmalloc (sizeof *x);
|
||||
#endif
|
||||
x->start = start;
|
||||
x->end = end;
|
||||
|
@ -5047,7 +5063,7 @@ pure_alloc (size_t size, int type)
|
|||
/* Don't allocate a large amount here,
|
||||
because it might get mmap'd and then its address
|
||||
might not be usable. */
|
||||
purebeg = (char *) xmalloc (10000);
|
||||
purebeg = xmalloc (10000);
|
||||
pure_size = 10000;
|
||||
pure_bytes_used_before_overflow += pure_bytes_used - size;
|
||||
pure_bytes_used = 0;
|
||||
|
|
|
@ -107,7 +107,7 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn,
|
|||
free_atimers = t->next;
|
||||
}
|
||||
else
|
||||
t = (struct atimer *) xmalloc (sizeof *t);
|
||||
t = xmalloc (sizeof *t);
|
||||
|
||||
/* Fill the atimer structure. */
|
||||
memset (t, 0, sizeof *t);
|
||||
|
|
|
@ -3893,7 +3893,7 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0,
|
|||
|
||||
len = 10;
|
||||
/* We can't use alloca here because overlays_at can call xrealloc. */
|
||||
overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
|
||||
overlay_vec = xmalloc (len * sizeof (Lisp_Object));
|
||||
|
||||
/* Put all the overlays we want in a vector in overlay_vec.
|
||||
Store the length in len. */
|
||||
|
@ -3924,7 +3924,7 @@ end of the buffer. */)
|
|||
CHECK_NUMBER_COERCE_MARKER (end);
|
||||
|
||||
len = 10;
|
||||
overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
|
||||
overlay_vec = xmalloc (len * sizeof (Lisp_Object));
|
||||
|
||||
/* Put all the overlays we want in a vector in overlay_vec.
|
||||
Store the length in len. */
|
||||
|
@ -3952,7 +3952,7 @@ the value is (point-max). */)
|
|||
CHECK_NUMBER_COERCE_MARKER (pos);
|
||||
|
||||
len = 10;
|
||||
overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
|
||||
overlay_vec = xmalloc (len * sizeof (Lisp_Object));
|
||||
|
||||
/* Put all the overlays we want in a vector in overlay_vec.
|
||||
Store the length in len.
|
||||
|
@ -3996,7 +3996,7 @@ the value is (point-min). */)
|
|||
return pos;
|
||||
|
||||
len = 10;
|
||||
overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
|
||||
overlay_vec = xmalloc (len * sizeof (Lisp_Object));
|
||||
|
||||
/* Put all the overlays we want in a vector in overlay_vec.
|
||||
Store the length in len.
|
||||
|
|
|
@ -1172,7 +1172,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
|
|||
/* MSDOS must have all environment variables malloc'ed, because
|
||||
low-level libc functions that launch subsidiary processes rely
|
||||
on that. */
|
||||
pwd_var = (char *) xmalloc (i + 6);
|
||||
pwd_var = xmalloc (i + 6);
|
||||
#else
|
||||
pwd_var = (char *) alloca (i + 6);
|
||||
#endif
|
||||
|
|
|
@ -2098,7 +2098,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
|
|||
outbufsize = (ccl.buf_magnification
|
||||
? str_bytes * ccl.buf_magnification + 256
|
||||
: str_bytes + 256);
|
||||
outp = outbuf = (unsigned char *) xmalloc (outbufsize);
|
||||
outp = outbuf = xmalloc (outbufsize);
|
||||
|
||||
consumed_chars = consumed_bytes = 0;
|
||||
produced_chars = 0;
|
||||
|
|
|
@ -912,8 +912,7 @@ usage: (define-charset-internal ...) */)
|
|||
|
||||
if (! charset.code_linear_p)
|
||||
{
|
||||
charset.code_space_mask = (unsigned char *) xmalloc (256);
|
||||
memset (charset.code_space_mask, 0, 256);
|
||||
charset.code_space_mask = xzalloc (256);
|
||||
for (i = 0; i < 4; i++)
|
||||
for (j = charset.code_space[i * 4]; j <= charset.code_space[i * 4 + 1];
|
||||
j++)
|
||||
|
|
|
@ -8006,7 +8006,7 @@ encode_coding_object (struct coding_system *coding,
|
|||
{
|
||||
ptrdiff_t dst_bytes = max (1, coding->src_chars);
|
||||
coding->dst_object = Qnil;
|
||||
coding->destination = (unsigned char *) xmalloc (dst_bytes);
|
||||
coding->destination = xmalloc (dst_bytes);
|
||||
coding->dst_bytes = dst_bytes;
|
||||
coding->dst_multibyte = 0;
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
|
|||
memory_full (SIZE_MAX);
|
||||
|
||||
/* Register the composition in composition_table. */
|
||||
cmp = (struct composition *) xmalloc (sizeof (struct composition));
|
||||
cmp = xmalloc (sizeof (struct composition));
|
||||
|
||||
cmp->method = method;
|
||||
cmp->hash_index = hash_index;
|
||||
|
|
|
@ -344,11 +344,7 @@ __executable_start (void)
|
|||
static struct glyph_matrix *
|
||||
new_glyph_matrix (struct glyph_pool *pool)
|
||||
{
|
||||
struct glyph_matrix *result;
|
||||
|
||||
/* Allocate and clear. */
|
||||
result = (struct glyph_matrix *) xmalloc (sizeof *result);
|
||||
memset (result, 0, sizeof *result);
|
||||
struct glyph_matrix *result = xzalloc (sizeof *result);
|
||||
|
||||
/* Increment number of allocated matrices. This count is used
|
||||
to detect memory leaks. */
|
||||
|
@ -1367,11 +1363,7 @@ row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
|
|||
static struct glyph_pool *
|
||||
new_glyph_pool (void)
|
||||
{
|
||||
struct glyph_pool *result;
|
||||
|
||||
/* Allocate a new glyph_pool and clear it. */
|
||||
result = (struct glyph_pool *) xmalloc (sizeof *result);
|
||||
memset (result, 0, sizeof *result);
|
||||
struct glyph_pool *result = xzalloc (sizeof *result);
|
||||
|
||||
/* For memory leak and double deletion checking. */
|
||||
++glyph_pool_count;
|
||||
|
@ -2033,19 +2025,16 @@ save_current_matrix (struct frame *f)
|
|||
int i;
|
||||
struct glyph_matrix *saved;
|
||||
|
||||
saved = (struct glyph_matrix *) xmalloc (sizeof *saved);
|
||||
memset (saved, 0, sizeof *saved);
|
||||
saved = xzalloc (sizeof *saved);
|
||||
saved->nrows = f->current_matrix->nrows;
|
||||
saved->rows = (struct glyph_row *) xmalloc (saved->nrows
|
||||
* sizeof *saved->rows);
|
||||
memset (saved->rows, 0, saved->nrows * sizeof *saved->rows);
|
||||
saved->rows = xzalloc (saved->nrows * sizeof *saved->rows);
|
||||
|
||||
for (i = 0; i < saved->nrows; ++i)
|
||||
{
|
||||
struct glyph_row *from = f->current_matrix->rows + i;
|
||||
struct glyph_row *to = saved->rows + i;
|
||||
ptrdiff_t nbytes = from->used[TEXT_AREA] * sizeof (struct glyph);
|
||||
to->glyphs[TEXT_AREA] = (struct glyph *) xmalloc (nbytes);
|
||||
to->glyphs[TEXT_AREA] = xmalloc (nbytes);
|
||||
memcpy (to->glyphs[TEXT_AREA], from->glyphs[TEXT_AREA], nbytes);
|
||||
to->used[TEXT_AREA] = from->used[TEXT_AREA];
|
||||
}
|
||||
|
@ -2263,7 +2252,7 @@ adjust_frame_message_buffer (struct frame *f)
|
|||
FRAME_MESSAGE_BUF (f) = new_buffer;
|
||||
}
|
||||
else
|
||||
FRAME_MESSAGE_BUF (f) = (char *) xmalloc (size);
|
||||
FRAME_MESSAGE_BUF (f) = xmalloc (size);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -757,7 +757,7 @@ Otherwise, return a new string, without any text properties. */)
|
|||
keymap = Voverriding_local_map;
|
||||
|
||||
bsize = SBYTES (string);
|
||||
bufp = buf = (char *) xmalloc (bsize);
|
||||
bufp = buf = xmalloc (bsize);
|
||||
|
||||
strp = SDATA (string);
|
||||
while (strp < SDATA (string) + SBYTES (string))
|
||||
|
|
|
@ -257,7 +257,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format,
|
|||
{
|
||||
if (big_buffer)
|
||||
xfree (big_buffer);
|
||||
big_buffer = (char *) xmalloc (size_bound);
|
||||
big_buffer = xmalloc (size_bound);
|
||||
sprintf_buffer = big_buffer;
|
||||
size_allocated = size_bound;
|
||||
}
|
||||
|
|
|
@ -2157,8 +2157,8 @@ set_time_zone_rule (const char *tzstring)
|
|||
for (from = environ; *from; from++)
|
||||
continue;
|
||||
envptrs = from - environ + 2;
|
||||
newenv = to = (char **) xmalloc (envptrs * sizeof (char *)
|
||||
+ (tzstring ? strlen (tzstring) + 4 : 0));
|
||||
newenv = to = xmalloc (envptrs * sizeof (char *)
|
||||
+ (tzstring ? strlen (tzstring) + 4 : 0));
|
||||
|
||||
/* Add TZSTRING to the end of environ, as a value for TZ. */
|
||||
if (tzstring)
|
||||
|
@ -3477,7 +3477,7 @@ usage: (message-box FORMAT-STRING &rest ARGS) */)
|
|||
/* Copy the data so that it won't move when we GC. */
|
||||
if (! message_text)
|
||||
{
|
||||
message_text = (char *)xmalloc (80);
|
||||
message_text = xmalloc (80);
|
||||
message_length = 80;
|
||||
}
|
||||
if (SBYTES (val) > message_length)
|
||||
|
|
|
@ -1820,7 +1820,7 @@ static const struct standard_args standard_args[] =
|
|||
static void
|
||||
sort_args (int argc, char **argv)
|
||||
{
|
||||
char **new = (char **) xmalloc (sizeof (char *) * argc);
|
||||
char **new = xmalloc (sizeof (char *) * argc);
|
||||
/* For each element of argv,
|
||||
the corresponding element of options is:
|
||||
0 for an option that takes no arguments,
|
||||
|
|
|
@ -138,7 +138,7 @@ void
|
|||
init_eval_once (void)
|
||||
{
|
||||
enum { size = 50 };
|
||||
specpdl = (struct specbinding *) xmalloc (size * sizeof (struct specbinding));
|
||||
specpdl = xmalloc (size * sizeof (struct specbinding));
|
||||
specpdl_size = size;
|
||||
specpdl_ptr = specpdl;
|
||||
/* Don't forget to update docs (lispref node "Local Variables"). */
|
||||
|
|
|
@ -422,7 +422,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
|
|||
return -1;
|
||||
}
|
||||
len = at - lfinfo;
|
||||
owner->user = (char *) xmalloc (len + 1);
|
||||
owner->user = xmalloc (len + 1);
|
||||
memcpy (owner->user, lfinfo, len);
|
||||
owner->user[len] = 0;
|
||||
|
||||
|
@ -449,7 +449,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
|
|||
|
||||
/* The host is everything in between. */
|
||||
len = dot - at - 1;
|
||||
owner->host = (char *) xmalloc (len + 1);
|
||||
owner->host = xmalloc (len + 1);
|
||||
memcpy (owner->host, at + 1, len);
|
||||
owner->host[len] = 0;
|
||||
|
||||
|
|
|
@ -1018,7 +1018,7 @@ If STRING is multibyte and contains a character of charset
|
|||
if (STRING_MULTIBYTE (string))
|
||||
{
|
||||
ptrdiff_t bytes = SBYTES (string);
|
||||
unsigned char *str = (unsigned char *) xmalloc (bytes);
|
||||
unsigned char *str = xmalloc (bytes);
|
||||
|
||||
memcpy (str, SDATA (string), bytes);
|
||||
bytes = str_as_unibyte (str, bytes);
|
||||
|
@ -1100,7 +1100,7 @@ an error is signaled. */)
|
|||
if (STRING_MULTIBYTE (string))
|
||||
{
|
||||
ptrdiff_t chars = SCHARS (string);
|
||||
unsigned char *str = (unsigned char *) xmalloc (chars);
|
||||
unsigned char *str = xmalloc (chars);
|
||||
ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars, 0);
|
||||
|
||||
if (converted < chars)
|
||||
|
|
13
src/fringe.c
13
src/fringe.c
|
@ -1639,8 +1639,7 @@ If BITMAP already exists, the existing definition is replaced. */)
|
|||
|
||||
fb.dynamic = 1;
|
||||
|
||||
xfb = (struct fringe_bitmap *) xmalloc (sizeof fb
|
||||
+ fb.height * BYTES_PER_BITMAP_ROW);
|
||||
xfb = xmalloc (sizeof fb + fb.height * BYTES_PER_BITMAP_ROW);
|
||||
fb.bits = b = (unsigned short *) (xfb + 1);
|
||||
memset (b, 0, fb.height);
|
||||
|
||||
|
@ -1805,15 +1804,11 @@ init_fringe (void)
|
|||
max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
|
||||
|
||||
fringe_bitmaps
|
||||
= (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
|
||||
fringe_faces
|
||||
= (Lisp_Object *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object));
|
||||
= xzalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
|
||||
fringe_faces = xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object));
|
||||
|
||||
for (i = 0; i < max_fringe_bitmaps; i++)
|
||||
{
|
||||
fringe_bitmaps[i] = NULL;
|
||||
fringe_faces[i] = Qnil;
|
||||
}
|
||||
fringe_faces[i] = Qnil;
|
||||
}
|
||||
|
||||
#ifdef HAVE_NTGUI
|
||||
|
|
|
@ -209,7 +209,7 @@ malloc_widget_value (void)
|
|||
}
|
||||
else
|
||||
{
|
||||
wv = (widget_value *) xmalloc (sizeof (widget_value));
|
||||
wv = xmalloc (sizeof (widget_value));
|
||||
malloc_cpt++;
|
||||
}
|
||||
memset (wv, 0, sizeof (widget_value));
|
||||
|
@ -2042,7 +2042,7 @@ make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
|
|||
{
|
||||
if (! cl_data)
|
||||
{
|
||||
cl_data = (xg_menu_cb_data*) xmalloc (sizeof (*cl_data));
|
||||
cl_data = xmalloc (sizeof (*cl_data));
|
||||
cl_data->f = f;
|
||||
cl_data->menu_bar_vector = f->menu_bar_vector;
|
||||
cl_data->menu_bar_items_used = f->menu_bar_items_used;
|
||||
|
|
55
src/image.c
55
src/image.c
|
@ -319,7 +319,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
|
|||
id = x_allocate_bitmap_record (f);
|
||||
dpyinfo->bitmaps[id - 1].img = bitmap;
|
||||
dpyinfo->bitmaps[id - 1].refcount = 1;
|
||||
dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1);
|
||||
dpyinfo->bitmaps[id - 1].file = xmalloc (SBYTES (file) + 1);
|
||||
dpyinfo->bitmaps[id - 1].depth = 1;
|
||||
dpyinfo->bitmaps[id - 1].height = ns_image_width (bitmap);
|
||||
dpyinfo->bitmaps[id - 1].width = ns_image_height (bitmap);
|
||||
|
@ -365,7 +365,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file)
|
|||
dpyinfo->bitmaps[id - 1].pixmap = bitmap;
|
||||
dpyinfo->bitmaps[id - 1].have_mask = 0;
|
||||
dpyinfo->bitmaps[id - 1].refcount = 1;
|
||||
dpyinfo->bitmaps[id - 1].file = (char *) xmalloc (SBYTES (file) + 1);
|
||||
dpyinfo->bitmaps[id - 1].file = xmalloc (SBYTES (file) + 1);
|
||||
dpyinfo->bitmaps[id - 1].depth = 1;
|
||||
dpyinfo->bitmaps[id - 1].height = height;
|
||||
dpyinfo->bitmaps[id - 1].width = width;
|
||||
|
@ -599,7 +599,7 @@ define_image_type (struct image_type *type, int loaded)
|
|||
{
|
||||
/* Make a copy of TYPE to avoid a bus error in a dumped Emacs.
|
||||
The initialized data segment is read-only. */
|
||||
struct image_type *p = (struct image_type *) xmalloc (sizeof *p);
|
||||
struct image_type *p = xmalloc (sizeof *p);
|
||||
memcpy (p, type, sizeof *p);
|
||||
p->next = image_types;
|
||||
image_types = p;
|
||||
|
@ -982,11 +982,10 @@ static void free_image (struct frame *f, struct image *img);
|
|||
static struct image *
|
||||
make_image (Lisp_Object spec, EMACS_UINT hash)
|
||||
{
|
||||
struct image *img = (struct image *) xmalloc (sizeof *img);
|
||||
struct image *img = xzalloc (sizeof *img);
|
||||
Lisp_Object file = image_spec_value (spec, QCfile, NULL);
|
||||
|
||||
eassert (valid_image_p (spec));
|
||||
memset (img, 0, sizeof *img);
|
||||
img->dependencies = NILP (file) ? Qnil : list1 (file);
|
||||
img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL));
|
||||
eassert (img->type != NULL);
|
||||
|
@ -1385,16 +1384,14 @@ static void postprocess_image (struct frame *, struct image *);
|
|||
struct image_cache *
|
||||
make_image_cache (void)
|
||||
{
|
||||
struct image_cache *c = (struct image_cache *) xmalloc (sizeof *c);
|
||||
struct image_cache *c = xzalloc (sizeof *c);
|
||||
int size;
|
||||
|
||||
memset (c, 0, sizeof *c);
|
||||
size = 50;
|
||||
c->images = (struct image **) xmalloc (size * sizeof *c->images);
|
||||
c->images = xmalloc (size * sizeof *c->images);
|
||||
c->size = size;
|
||||
size = IMAGE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
|
||||
c->buckets = (struct image **) xmalloc (size);
|
||||
memset (c->buckets, 0, size);
|
||||
c->buckets = xzalloc (size);
|
||||
return c;
|
||||
}
|
||||
|
||||
|
@ -1969,7 +1966,7 @@ x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
|
|||
}
|
||||
|
||||
/* Allocate image raster. */
|
||||
(*ximg)->data = (char *) xmalloc ((*ximg)->bytes_per_line * height);
|
||||
(*ximg)->data = xmalloc ((*ximg)->bytes_per_line * height);
|
||||
|
||||
/* Allocate a pixmap of the same size. */
|
||||
*pixmap = XCreatePixmap (display, window, width, height, depth);
|
||||
|
@ -2183,7 +2180,7 @@ slurp_file (char *file, ptrdiff_t *size)
|
|||
if (stat (file, &st) == 0
|
||||
&& (fp = fopen (file, "rb")) != NULL
|
||||
&& 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX)
|
||||
&& (buf = (unsigned char *) xmalloc (st.st_size),
|
||||
&& (buf = xmalloc (st.st_size),
|
||||
fread (buf, 1, st.st_size, fp) == st.st_size))
|
||||
{
|
||||
*size = st.st_size;
|
||||
|
@ -2705,7 +2702,7 @@ xbm_read_bitmap_data (struct frame *f, unsigned char *contents, unsigned char *e
|
|||
}
|
||||
bytes_per_line = (*width + 7) / 8 + padding_p;
|
||||
nbytes = bytes_per_line * *height;
|
||||
p = *data = (char *) xmalloc (nbytes);
|
||||
p = *data = xmalloc (nbytes);
|
||||
|
||||
if (v10)
|
||||
{
|
||||
|
@ -3118,8 +3115,7 @@ static void
|
|||
xpm_init_color_cache (struct frame *f, XpmAttributes *attrs)
|
||||
{
|
||||
size_t nbytes = XPM_COLOR_CACHE_BUCKETS * sizeof *xpm_color_cache;
|
||||
xpm_color_cache = (struct xpm_cached_color **) xmalloc (nbytes);
|
||||
memset (xpm_color_cache, 0, nbytes);
|
||||
xpm_color_cache = xzalloc (nbytes);
|
||||
init_color_table ();
|
||||
|
||||
if (attrs->valuemask & XpmColorSymbols)
|
||||
|
@ -3183,7 +3179,7 @@ xpm_cache_color (struct frame *f, char *color_name, XColor *color, int bucket)
|
|||
bucket = xpm_color_bucket (color_name);
|
||||
|
||||
nbytes = offsetof (struct xpm_cached_color, name) + strlen (color_name) + 1;
|
||||
p = (struct xpm_cached_color *) xmalloc (nbytes);
|
||||
p = xmalloc (nbytes);
|
||||
strcpy (p->name, color_name);
|
||||
p->color = *color;
|
||||
p->next = xpm_color_cache[bucket];
|
||||
|
@ -4154,8 +4150,7 @@ static void
|
|||
init_color_table (void)
|
||||
{
|
||||
int size = CT_SIZE * sizeof (*ct_table);
|
||||
ct_table = (struct ct_color **) xmalloc (size);
|
||||
memset (ct_table, 0, size);
|
||||
ct_table = xzalloc (size);
|
||||
ct_colors_allocated = 0;
|
||||
}
|
||||
|
||||
|
@ -4250,7 +4245,7 @@ lookup_rgb_color (struct frame *f, int r, int g, int b)
|
|||
if (rc)
|
||||
{
|
||||
++ct_colors_allocated;
|
||||
p = (struct ct_color *) xmalloc (sizeof *p);
|
||||
p = xmalloc (sizeof *p);
|
||||
p->r = r;
|
||||
p->g = g;
|
||||
p->b = b;
|
||||
|
@ -4268,7 +4263,7 @@ lookup_rgb_color (struct frame *f, int r, int g, int b)
|
|||
color = RGB_TO_ULONG (r, g, b);
|
||||
#endif /* HAVE_NTGUI */
|
||||
++ct_colors_allocated;
|
||||
p = (struct ct_color *) xmalloc (sizeof *p);
|
||||
p = xmalloc (sizeof *p);
|
||||
p->r = r;
|
||||
p->g = g;
|
||||
p->b = b;
|
||||
|
@ -4323,7 +4318,7 @@ lookup_pixel_color (struct frame *f, unsigned long pixel)
|
|||
{
|
||||
++ct_colors_allocated;
|
||||
|
||||
p = (struct ct_color *) xmalloc (sizeof *p);
|
||||
p = xmalloc (sizeof *p);
|
||||
p->r = color.red;
|
||||
p->g = color.green;
|
||||
p->b = color.blue;
|
||||
|
@ -4355,8 +4350,7 @@ colors_in_color_table (int *n)
|
|||
}
|
||||
else
|
||||
{
|
||||
colors = (unsigned long *) xmalloc (ct_colors_allocated
|
||||
* sizeof *colors);
|
||||
colors = xmalloc (ct_colors_allocated * sizeof *colors);
|
||||
*n = ct_colors_allocated;
|
||||
|
||||
for (i = j = 0; i < CT_SIZE; ++i)
|
||||
|
@ -4445,7 +4439,7 @@ x_to_xcolors (struct frame *f, struct image *img, int rgb_p)
|
|||
|
||||
if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *colors / img->width < img->height)
|
||||
memory_full (SIZE_MAX);
|
||||
colors = (XColor *) xmalloc (sizeof *colors * img->width * img->height);
|
||||
colors = xmalloc (sizeof *colors * img->width * img->height);
|
||||
|
||||
#ifndef HAVE_NTGUI
|
||||
/* Get the X image IMG->pixmap. */
|
||||
|
@ -4599,7 +4593,7 @@ x_detect_edges (struct frame *f, struct image *img, int *matrix, int color_adjus
|
|||
|
||||
if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *new / img->width < img->height)
|
||||
memory_full (SIZE_MAX);
|
||||
new = (XColor *) xmalloc (sizeof *new * img->width * img->height);
|
||||
new = xmalloc (sizeof *new * img->width * img->height);
|
||||
|
||||
for (y = 0; y < img->height; ++y)
|
||||
{
|
||||
|
@ -4852,8 +4846,7 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how)
|
|||
#else
|
||||
/* Create the bit array serving as mask. */
|
||||
row_width = (img->width + 7) / 8;
|
||||
mask_img = xmalloc (row_width * img->height);
|
||||
memset (mask_img, 0, row_width * img->height);
|
||||
mask_img = xzalloc (row_width * img->height);
|
||||
|
||||
/* Create a memory device context for IMG->pixmap. */
|
||||
frame_dc = get_frame_dc (f);
|
||||
|
@ -5069,7 +5062,7 @@ pbm_read_file (Lisp_Object file, int *size)
|
|||
if (stat (SDATA (file), &st) == 0
|
||||
&& (fp = fopen (SDATA (file), "rb")) != NULL
|
||||
&& 0 <= st.st_size && st.st_size <= min (PTRDIFF_MAX, SIZE_MAX)
|
||||
&& (buf = (char *) xmalloc (st.st_size),
|
||||
&& (buf = xmalloc (st.st_size),
|
||||
fread (buf, 1, st.st_size, fp) == st.st_size))
|
||||
{
|
||||
*size = st.st_size;
|
||||
|
@ -5840,8 +5833,8 @@ png_load (struct frame *f, struct image *img)
|
|||
if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof *rows < height
|
||||
|| min (PTRDIFF_MAX, SIZE_MAX) / sizeof *pixels / height < row_bytes)
|
||||
memory_full (SIZE_MAX);
|
||||
pixels = (png_byte *) xmalloc (sizeof *pixels * row_bytes * height);
|
||||
rows = (png_byte **) xmalloc (height * sizeof *rows);
|
||||
pixels = xmalloc (sizeof *pixels * row_bytes * height);
|
||||
rows = xmalloc (height * sizeof *rows);
|
||||
for (i = 0; i < height; ++i)
|
||||
rows[i] = pixels + i * row_bytes;
|
||||
|
||||
|
@ -6890,7 +6883,7 @@ tiff_load (struct frame *f, struct image *img)
|
|||
return 0;
|
||||
}
|
||||
|
||||
buf = (uint32 *) xmalloc (sizeof *buf * width * height);
|
||||
buf = xmalloc (sizeof *buf * width * height);
|
||||
|
||||
rc = fn_TIFFReadRGBAImage (tiff, width, height, buf, 0);
|
||||
|
||||
|
|
|
@ -884,8 +884,7 @@ static struct kboard_stack *kboard_stack;
|
|||
void
|
||||
push_kboard (struct kboard *k)
|
||||
{
|
||||
struct kboard_stack *p
|
||||
= (struct kboard_stack *) xmalloc (sizeof (struct kboard_stack));
|
||||
struct kboard_stack *p = xmalloc (sizeof (struct kboard_stack));
|
||||
|
||||
p->next = kboard_stack;
|
||||
p->kboard = current_kboard;
|
||||
|
@ -8323,7 +8322,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
|
|||
const char *capt = STRINGP (tcapt) ? SSDATA (tcapt) : "";
|
||||
ptrdiff_t max_lbl =
|
||||
2 * max (0, min (tool_bar_max_label_size, STRING_BYTES_BOUND / 2));
|
||||
char *buf = (char *) xmalloc (max_lbl + 1);
|
||||
char *buf = xmalloc (max_lbl + 1);
|
||||
Lisp_Object new_lbl;
|
||||
ptrdiff_t caption_len = strlen (capt);
|
||||
|
||||
|
@ -12188,7 +12187,7 @@ variable are `sigusr1' and `sigusr2'. */);
|
|||
Vdebug_on_event = intern_c_string ("sigusr2");
|
||||
|
||||
/* Create the initial keyboard. */
|
||||
initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
|
||||
initial_kboard = xmalloc (sizeof (KBOARD));
|
||||
init_kboard (initial_kboard);
|
||||
/* Vwindow_system is left at t for now. */
|
||||
initial_kboard->next_kboard = all_kboards;
|
||||
|
|
|
@ -3237,6 +3237,7 @@ extern int initialized;
|
|||
extern int immediate_quit; /* Nonzero means ^G can quit instantly */
|
||||
|
||||
extern void *xmalloc (size_t);
|
||||
extern void *xzalloc (size_t);
|
||||
extern void *xrealloc (void *, size_t);
|
||||
extern void xfree (void *);
|
||||
extern void *xnmalloc (ptrdiff_t, ptrdiff_t);
|
||||
|
@ -3352,7 +3353,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
|
|||
buf = (type) alloca (size); \
|
||||
else \
|
||||
{ \
|
||||
buf = (type) xmalloc (size); \
|
||||
buf = xmalloc (size); \
|
||||
sa_must_free = 1; \
|
||||
record_unwind_protect (safe_alloca_unwind, \
|
||||
make_save_value (buf, 0)); \
|
||||
|
@ -3396,7 +3397,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
|
|||
else if ((nelt) < min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object)) \
|
||||
{ \
|
||||
Lisp_Object arg_; \
|
||||
buf = (Lisp_Object *) xmalloc ((nelt) * sizeof (Lisp_Object)); \
|
||||
buf = xmalloc ((nelt) * sizeof (Lisp_Object)); \
|
||||
arg_ = make_save_value (buf, nelt); \
|
||||
XSAVE_VALUE (arg_)->dogc = 1; \
|
||||
sa_must_free = 1; \
|
||||
|
|
|
@ -2625,7 +2625,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
|
|||
|
||||
if (saved_doc_string_size == 0)
|
||||
{
|
||||
saved_doc_string = (char *) xmalloc (nskip + extra);
|
||||
saved_doc_string = xmalloc (nskip + extra);
|
||||
saved_doc_string_size = nskip + extra;
|
||||
}
|
||||
if (nskip > saved_doc_string_size)
|
||||
|
@ -3966,7 +3966,7 @@ init_obarray (void)
|
|||
|
||||
DEFSYM (Qvariable_documentation, "variable-documentation");
|
||||
|
||||
read_buffer = (char *) xmalloc (size);
|
||||
read_buffer = xmalloc (size);
|
||||
read_buffer_size = size;
|
||||
}
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
|
|||
val = Qnil;
|
||||
size = 100;
|
||||
len = 0;
|
||||
line = (char *) xmalloc (size);
|
||||
line = xmalloc (size);
|
||||
|
||||
while ((c = getchar ()) != '\n')
|
||||
{
|
||||
|
|
12
src/msdos.c
12
src/msdos.c
|
@ -2828,7 +2828,7 @@ IT_menu_create (void)
|
|||
{
|
||||
XMenu *menu;
|
||||
|
||||
menu = (XMenu *) xmalloc (sizeof (XMenu));
|
||||
menu = xmalloc (sizeof (XMenu));
|
||||
menu->allocated = menu->count = menu->panecount = menu->width = 0;
|
||||
return menu;
|
||||
}
|
||||
|
@ -2842,10 +2842,10 @@ IT_menu_make_room (XMenu *menu)
|
|||
if (menu->allocated == 0)
|
||||
{
|
||||
int count = menu->allocated = 10;
|
||||
menu->text = (char **) xmalloc (count * sizeof (char *));
|
||||
menu->submenu = (XMenu **) xmalloc (count * sizeof (XMenu *));
|
||||
menu->panenumber = (int *) xmalloc (count * sizeof (int));
|
||||
menu->help_text = (const char **) xmalloc (count * sizeof (char *));
|
||||
menu->text = xmalloc (count * sizeof (char *));
|
||||
menu->submenu = xmalloc (count * sizeof (XMenu *));
|
||||
menu->panenumber = xmalloc (count * sizeof (int));
|
||||
menu->help_text = xmalloc (count * sizeof (char *));
|
||||
}
|
||||
else if (menu->allocated == menu->count)
|
||||
{
|
||||
|
@ -2926,7 +2926,7 @@ IT_menu_display (XMenu *menu, int y, int x, int pn, int *faces, int disp_help)
|
|||
width = menu->width;
|
||||
/* We multiply width by 2 to account for possible control characters.
|
||||
FIXME: cater to non-ASCII characters in menus. */
|
||||
text = (struct glyph *) xmalloc ((width * 2 + 2) * sizeof (struct glyph));
|
||||
text = xmalloc ((width * 2 + 2) * sizeof (struct glyph));
|
||||
ScreenGetCursor (&row, &col);
|
||||
mouse_get_xy (&mx, &my);
|
||||
IT_update_begin (sf);
|
||||
|
|
|
@ -157,7 +157,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
|
|||
else \
|
||||
{ \
|
||||
int new_size = 1000; \
|
||||
print_buffer = (char *) xmalloc (new_size); \
|
||||
print_buffer = xmalloc (new_size); \
|
||||
print_buffer_size = new_size; \
|
||||
free_print_buffer = 1; \
|
||||
} \
|
||||
|
|
|
@ -3316,7 +3316,7 @@ usage: (make-network-process &rest ARGS) */)
|
|||
{
|
||||
if (datagram_address[s].sa)
|
||||
abort ();
|
||||
datagram_address[s].sa = (struct sockaddr *) xmalloc (lres->ai_addrlen);
|
||||
datagram_address[s].sa = xmalloc (lres->ai_addrlen);
|
||||
datagram_address[s].len = lres->ai_addrlen;
|
||||
if (is_server)
|
||||
{
|
||||
|
@ -6286,7 +6286,7 @@ process has been transmitted to the serial port. */)
|
|||
|
||||
if (!proc_encode_coding_system[new_outfd])
|
||||
proc_encode_coding_system[new_outfd]
|
||||
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
|
||||
= xmalloc (sizeof (struct coding_system));
|
||||
memcpy (proc_encode_coding_system[new_outfd],
|
||||
proc_encode_coding_system[old_outfd],
|
||||
sizeof (struct coding_system));
|
||||
|
@ -7084,7 +7084,7 @@ setup_process_coding_systems (Lisp_Object process)
|
|||
|
||||
if (!proc_decode_coding_system[inch])
|
||||
proc_decode_coding_system[inch]
|
||||
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
|
||||
= xmalloc (sizeof (struct coding_system));
|
||||
coding_system = p->decode_coding_system;
|
||||
if (! NILP (p->filter))
|
||||
;
|
||||
|
@ -7097,7 +7097,7 @@ setup_process_coding_systems (Lisp_Object process)
|
|||
|
||||
if (!proc_encode_coding_system[outch])
|
||||
proc_encode_coding_system[outch]
|
||||
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
|
||||
= xmalloc (sizeof (struct coding_system));
|
||||
setup_coding_system (p->encode_coding_system,
|
||||
proc_encode_coding_system[outch]);
|
||||
#endif
|
||||
|
|
|
@ -132,15 +132,13 @@ static void revalidate_region_cache (struct buffer *buf, struct region_cache *c)
|
|||
struct region_cache *
|
||||
new_region_cache (void)
|
||||
{
|
||||
struct region_cache *c
|
||||
= (struct region_cache *) xmalloc (sizeof (struct region_cache));
|
||||
struct region_cache *c = xmalloc (sizeof (struct region_cache));
|
||||
|
||||
c->gap_start = 0;
|
||||
c->gap_len = NEW_CACHE_GAP;
|
||||
c->cache_len = 0;
|
||||
c->boundaries =
|
||||
(struct boundary *) xmalloc ((c->gap_len + c->cache_len)
|
||||
* sizeof (*c->boundaries));
|
||||
c->boundaries = xmalloc ((c->gap_len + c->cache_len)
|
||||
* sizeof (*c->boundaries));
|
||||
|
||||
c->beg_unchanged = 0;
|
||||
c->end_unchanged = 0;
|
||||
|
|
|
@ -2064,8 +2064,8 @@ set_search_regs (ptrdiff_t beg_byte, ptrdiff_t nbytes)
|
|||
the match position. */
|
||||
if (search_regs.num_regs == 0)
|
||||
{
|
||||
search_regs.start = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
|
||||
search_regs.end = (regoff_t *) xmalloc (2 * sizeof (regoff_t));
|
||||
search_regs.start = xmalloc (2 * sizeof (regoff_t));
|
||||
search_regs.end = xmalloc (2 * sizeof (regoff_t));
|
||||
search_regs.num_regs = 2;
|
||||
}
|
||||
|
||||
|
@ -2500,7 +2500,7 @@ since only regular expressions have distinguished subexpressions. */)
|
|||
substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length
|
||||
? STRING_BYTES_BOUND
|
||||
: length * 2 + 100);
|
||||
substed = (unsigned char *) xmalloc (substed_alloc_size);
|
||||
substed = xmalloc (substed_alloc_size);
|
||||
substed_len = 0;
|
||||
|
||||
/* Go thru NEWTEXT, producing the actual text to insert in
|
||||
|
@ -3040,7 +3040,7 @@ syms_of_search (void)
|
|||
for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
|
||||
{
|
||||
searchbufs[i].buf.allocated = 100;
|
||||
searchbufs[i].buf.buffer = (unsigned char *) xmalloc (100);
|
||||
searchbufs[i].buf.buffer = xmalloc (100);
|
||||
searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
|
||||
searchbufs[i].regexp = Qnil;
|
||||
searchbufs[i].whitespace_regexp = Qnil;
|
||||
|
|
|
@ -1364,10 +1364,8 @@ Internal use only, use `play-sound' instead. */)
|
|||
#ifndef WINDOWSNT
|
||||
file = Qnil;
|
||||
GCPRO2 (sound, file);
|
||||
current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device));
|
||||
memset (current_sound_device, 0, sizeof (struct sound_device));
|
||||
current_sound = (struct sound *) xmalloc (sizeof (struct sound));
|
||||
memset (current_sound, 0, sizeof (struct sound));
|
||||
current_sound_device = xzalloc (sizeof (struct sound_device));
|
||||
current_sound = xzalloc (sizeof (struct sound));
|
||||
record_unwind_protect (sound_cleanup, Qnil);
|
||||
current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES);
|
||||
|
||||
|
|
|
@ -851,7 +851,7 @@ init_sys_modes (struct tty_display_info *tty_out)
|
|||
return; /* The tty is suspended. */
|
||||
|
||||
if (! tty_out->old_tty)
|
||||
tty_out->old_tty = (struct emacs_tty *) xmalloc (sizeof (struct emacs_tty));
|
||||
tty_out->old_tty = xmalloc (sizeof (struct emacs_tty));
|
||||
|
||||
emacs_get_tty (fileno (tty_out->input), tty_out->old_tty);
|
||||
|
||||
|
|
14
src/term.c
14
src/term.c
|
@ -2863,8 +2863,7 @@ create_tty_output (struct frame *f)
|
|||
if (! FRAME_TERMCAP_P (f))
|
||||
abort ();
|
||||
|
||||
t = xmalloc (sizeof (struct tty_output));
|
||||
memset (t, 0, sizeof (struct tty_output));
|
||||
t = xzalloc (sizeof (struct tty_output));
|
||||
|
||||
t->display_info = FRAME_TERMINAL (f)->display_info.tty;
|
||||
|
||||
|
@ -3065,9 +3064,8 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
|
|||
been_here = 1;
|
||||
tty = &the_only_display_info;
|
||||
#else
|
||||
tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
|
||||
tty = xzalloc (sizeof (struct tty_display_info));
|
||||
#endif
|
||||
memset (tty, 0, sizeof (struct tty_display_info));
|
||||
tty->next = tty_list;
|
||||
tty_list = tty;
|
||||
|
||||
|
@ -3075,7 +3073,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
|
|||
terminal->display_info.tty = tty;
|
||||
tty->terminal = terminal;
|
||||
|
||||
tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
|
||||
tty->Wcm = xmalloc (sizeof (struct cm));
|
||||
Wcm_clear (tty);
|
||||
|
||||
encode_terminal_src_size = 0;
|
||||
|
@ -3136,7 +3134,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed)
|
|||
|
||||
Wcm_clear (tty);
|
||||
|
||||
tty->termcap_term_buffer = (char *) xmalloc (buffer_size);
|
||||
tty->termcap_term_buffer = xmalloc (buffer_size);
|
||||
|
||||
/* On some systems, tgetent tries to access the controlling
|
||||
terminal. */
|
||||
|
@ -3177,7 +3175,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
|
|||
abort ();
|
||||
buffer_size = strlen (tty->termcap_term_buffer);
|
||||
#endif
|
||||
tty->termcap_strings_buffer = area = (char *) xmalloc (buffer_size);
|
||||
tty->termcap_strings_buffer = area = xmalloc (buffer_size);
|
||||
tty->TS_ins_line = tgetstr ("al", address);
|
||||
tty->TS_ins_multi_lines = tgetstr ("AL", address);
|
||||
tty->TS_bell = tgetstr ("bl", address);
|
||||
|
@ -3345,7 +3343,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
|
|||
tty->mouse_highlight.mouse_face_window = Qnil;
|
||||
#endif
|
||||
|
||||
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
|
||||
terminal->kboard = xmalloc (sizeof (KBOARD));
|
||||
init_kboard (terminal->kboard);
|
||||
KVAR (terminal->kboard, Vwindow_system) = Qnil;
|
||||
terminal->kboard->next_kboard = all_kboards;
|
||||
|
|
|
@ -153,7 +153,7 @@ tgetst1 (char *ptr, char **area)
|
|||
p = ptr;
|
||||
while ((c = *p++) && c != ':' && c != '\n')
|
||||
;
|
||||
ret = (char *) xmalloc (p - ptr + 1);
|
||||
ret = xmalloc (p - ptr + 1);
|
||||
}
|
||||
else
|
||||
ret = *area;
|
||||
|
@ -377,7 +377,7 @@ tgetent (char *bp, const char *name)
|
|||
if (!bp)
|
||||
{
|
||||
malloc_size = 1 + strlen (term);
|
||||
bp = (char *) xmalloc (malloc_size);
|
||||
bp = xmalloc (malloc_size);
|
||||
}
|
||||
strcpy (bp, term);
|
||||
goto ret;
|
||||
|
@ -440,13 +440,13 @@ tgetent (char *bp, const char *name)
|
|||
|
||||
buf.size = BUFSIZE;
|
||||
/* Add 1 to size to ensure room for terminating null. */
|
||||
buf.beg = (char *) xmalloc (buf.size + 1);
|
||||
buf.beg = xmalloc (buf.size + 1);
|
||||
term = indirect ? indirect : (char *)name;
|
||||
|
||||
if (!bp)
|
||||
{
|
||||
malloc_size = indirect ? strlen (tcenv) + 1 : buf.size;
|
||||
bp = (char *) xmalloc (malloc_size);
|
||||
bp = xmalloc (malloc_size);
|
||||
}
|
||||
tc_search_point = bp1 = bp;
|
||||
|
||||
|
|
|
@ -230,10 +230,8 @@ create_terminal (void)
|
|||
|
||||
terminal->id = next_terminal_id++;
|
||||
|
||||
terminal->keyboard_coding =
|
||||
(struct coding_system *) xmalloc (sizeof (struct coding_system));
|
||||
terminal->terminal_coding =
|
||||
(struct coding_system *) xmalloc (sizeof (struct coding_system));
|
||||
terminal->keyboard_coding = xmalloc (sizeof (struct coding_system));
|
||||
terminal->terminal_coding = xmalloc (sizeof (struct coding_system));
|
||||
|
||||
/* If default coding systems for the terminal and the keyboard are
|
||||
already defined, use them in preference to the defaults. This is
|
||||
|
|
|
@ -98,7 +98,7 @@ tparam1 (const char *string, char *outstring, int len,
|
|||
if (outlen == 0)
|
||||
{
|
||||
outlen = len + 40;
|
||||
new = (char *) xmalloc (outlen);
|
||||
new = xmalloc (outlen);
|
||||
memcpy (new, outstring, offset);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -493,7 +493,7 @@ DEFUN ("w16-set-clipboard-data", Fw16_set_clipboard_data, Sw16_set_clipboard_dat
|
|||
|
||||
setup_coding_system (Fcheck_coding_system (coding_system), &coding);
|
||||
coding.dst_bytes = nbytes * 4;
|
||||
coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
|
||||
coding.destination = xmalloc (coding.dst_bytes);
|
||||
Vnext_selection_coding_system = Qnil;
|
||||
coding.mode |= CODING_MODE_LAST_BLOCK;
|
||||
dst = coding.destination;
|
||||
|
@ -572,7 +572,7 @@ DEFUN ("w16-get-clipboard-data", Fw16_get_clipboard_data, Sw16_get_clipboard_dat
|
|||
goto unblock;
|
||||
|
||||
if ((data_size = get_clipboard_data_size (CF_OEMTEXT)) == 0 ||
|
||||
(htext = (unsigned char *)xmalloc (data_size)) == 0)
|
||||
(htext = xmalloc (data_size)) == 0)
|
||||
goto closeclip;
|
||||
|
||||
/* need to know final size after '\r' chars are removed because
|
||||
|
|
|
@ -1476,7 +1476,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype)
|
|||
lpvalue = NULL;
|
||||
|
||||
if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS
|
||||
&& (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
|
||||
&& (lpvalue = xmalloc (cbData)) != NULL
|
||||
&& RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey (hrootkey);
|
||||
|
@ -1493,7 +1493,7 @@ w32_get_resource (char *key, LPDWORD lpdwtype)
|
|||
lpvalue = NULL;
|
||||
|
||||
if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData) == ERROR_SUCCESS
|
||||
&& (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
|
||||
&& (lpvalue = xmalloc (cbData)) != NULL
|
||||
&& RegQueryValueEx (hrootkey, key, NULL, lpdwtype, lpvalue, &cbData) == ERROR_SUCCESS)
|
||||
{
|
||||
RegCloseKey (hrootkey);
|
||||
|
@ -2169,7 +2169,7 @@ GetCachedVolumeInformation (char * root_dir)
|
|||
entry if present. */
|
||||
if (info == NULL)
|
||||
{
|
||||
info = (volume_info_data *) xmalloc (sizeof (volume_info_data));
|
||||
info = xmalloc (sizeof (volume_info_data));
|
||||
add_volume_info (root_dir, info);
|
||||
}
|
||||
else
|
||||
|
|
18
src/w32fns.c
18
src/w32fns.c
|
@ -1006,8 +1006,7 @@ w32_map_color (FRAME_PTR f, COLORREF color)
|
|||
}
|
||||
|
||||
/* not already mapped, so add to list and recreate Windows palette */
|
||||
list = (struct w32_palette_entry *)
|
||||
xmalloc (sizeof (struct w32_palette_entry));
|
||||
list = xmalloc (sizeof (struct w32_palette_entry));
|
||||
SET_W32_COLOR (list->entry, color);
|
||||
list->refcount = 1;
|
||||
list->next = FRAME_W32_DISPLAY_INFO (f)->color_list;
|
||||
|
@ -1109,8 +1108,7 @@ w32_defined_color (FRAME_PTR f, char *color, XColor *color_def, int alloc)
|
|||
if (entry == NULL && alloc)
|
||||
{
|
||||
/* not already mapped, so add to list */
|
||||
entry = (struct w32_palette_entry *)
|
||||
xmalloc (sizeof (struct w32_palette_entry));
|
||||
entry = xmalloc (sizeof (struct w32_palette_entry));
|
||||
SET_W32_COLOR (entry->entry, XUINT (tem));
|
||||
entry->next = NULL;
|
||||
*prev = entry;
|
||||
|
@ -3881,7 +3879,7 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
|
|||
|
||||
{
|
||||
char *str = SSDATA (Vx_resource_name);
|
||||
f->namebuf = (char *) xmalloc (strlen (str) + 1);
|
||||
f->namebuf = xmalloc (strlen (str) + 1);
|
||||
strcpy (f->namebuf, str);
|
||||
}
|
||||
|
||||
|
@ -4145,9 +4143,7 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
f->terminal = dpyinfo->terminal;
|
||||
|
||||
f->output_method = output_w32;
|
||||
f->output_data.w32 =
|
||||
(struct w32_output *) xmalloc (sizeof (struct w32_output));
|
||||
memset (f->output_data.w32, 0, sizeof (struct w32_output));
|
||||
f->output_data.w32 = xzalloc (sizeof (struct w32_output));
|
||||
FRAME_FONTSET (f) = -1;
|
||||
|
||||
f->icon_name
|
||||
|
@ -5230,9 +5226,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
|
|||
counts etc. */
|
||||
f->terminal = dpyinfo->terminal;
|
||||
f->output_method = output_w32;
|
||||
f->output_data.w32 =
|
||||
(struct w32_output *) xmalloc (sizeof (struct w32_output));
|
||||
memset (f->output_data.w32, 0, sizeof (struct w32_output));
|
||||
f->output_data.w32 = xzalloc (sizeof (struct w32_output));
|
||||
|
||||
FRAME_FONTSET (f) = -1;
|
||||
f->icon_name = Qnil;
|
||||
|
@ -6687,7 +6681,7 @@ DEFUN ("default-printer-name", Fdefault_printer_name, Sdefault_printer_name,
|
|||
return Qnil;
|
||||
}
|
||||
/* Allocate memory for the PRINTER_INFO_2 struct */
|
||||
ppi2 = (PRINTER_INFO_2 *) xmalloc (dwNeeded);
|
||||
ppi2 = xmalloc (dwNeeded);
|
||||
if (!ppi2)
|
||||
{
|
||||
ClosePrinter (hPrn);
|
||||
|
|
|
@ -529,9 +529,7 @@ w32font_text_extents (struct font *font, unsigned *code,
|
|||
if (!w32_font->cached_metrics[block])
|
||||
{
|
||||
w32_font->cached_metrics[block]
|
||||
= xmalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
|
||||
memset (w32_font->cached_metrics[block], 0,
|
||||
CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
|
||||
= xzalloc (CACHE_BLOCKSIZE * sizeof (struct w32_metric_cache));
|
||||
}
|
||||
|
||||
char_metric = w32_font->cached_metrics[block] + pos_in_block;
|
||||
|
|
|
@ -110,7 +110,7 @@ w32_get_string_resource (char *name, char *class, DWORD dwexptype)
|
|||
}
|
||||
|
||||
ok = (keyname
|
||||
&& (lpvalue = (LPBYTE) xmalloc (cbData)) != NULL
|
||||
&& (lpvalue = xmalloc (cbData)) != NULL
|
||||
&& RegQueryValueEx (hrootkey, keyname, NULL, NULL, lpvalue, &cbData) == ERROR_SUCCESS);
|
||||
|
||||
RegCloseKey (hrootkey);
|
||||
|
|
|
@ -216,7 +216,7 @@ convert_to_handle_as_coded (Lisp_Object coding_system)
|
|||
|
||||
setup_windows_coding_system (coding_system, &coding);
|
||||
coding.dst_bytes = SBYTES (current_text) * 2;
|
||||
coding.destination = (unsigned char *) xmalloc (coding.dst_bytes);
|
||||
coding.destination = xmalloc (coding.dst_bytes);
|
||||
encode_coding_object (&coding, current_text, 0, 0,
|
||||
SCHARS (current_text), SBYTES (current_text), Qnil);
|
||||
|
||||
|
|
|
@ -285,8 +285,7 @@ XChangeGC (void *ignore, XGCValues *gc, unsigned long mask,
|
|||
XGCValues *
|
||||
XCreateGC (void *ignore, Window window, unsigned long mask, XGCValues *xgcv)
|
||||
{
|
||||
XGCValues *gc = (XGCValues *) xmalloc (sizeof (XGCValues));
|
||||
memset (gc, 0, sizeof (XGCValues));
|
||||
XGCValues *gc = xzalloc (sizeof (XGCValues));
|
||||
|
||||
XChangeGC (ignore, gc, mask, xgcv);
|
||||
|
||||
|
@ -6060,10 +6059,8 @@ w32_initialize_display_info (Lisp_Object display_name)
|
|||
w32_display_name_list);
|
||||
dpyinfo->name_list_element = XCAR (w32_display_name_list);
|
||||
|
||||
dpyinfo->w32_id_name
|
||||
= (char *) xmalloc (SCHARS (Vinvocation_name)
|
||||
+ SCHARS (Vsystem_name)
|
||||
+ 2);
|
||||
dpyinfo->w32_id_name = xmalloc (SCHARS (Vinvocation_name)
|
||||
+ SCHARS (Vsystem_name) + 2);
|
||||
sprintf (dpyinfo->w32_id_name, "%s@%s",
|
||||
SDATA (Vinvocation_name), SDATA (Vsystem_name));
|
||||
|
||||
|
@ -6228,7 +6225,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo)
|
|||
/* We don't yet support separate terminals on W32, so don't try to share
|
||||
keyboards between virtual terminals that are on the same physical
|
||||
terminal like X does. */
|
||||
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
|
||||
terminal->kboard = xmalloc (sizeof (KBOARD));
|
||||
init_kboard (terminal->kboard);
|
||||
KVAR (terminal->kboard, Vwindow_system) = intern ("w32");
|
||||
terminal->kboard->next_kboard = all_kboards;
|
||||
|
@ -6280,7 +6277,7 @@ w32_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
terminal = w32_create_terminal (dpyinfo);
|
||||
|
||||
/* Set the name of the terminal. */
|
||||
terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
|
||||
terminal->name = xmalloc (SBYTES (display_name) + 1);
|
||||
strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
|
||||
terminal->name[SBYTES (display_name)] = 0;
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ uniscribe_shape (Lisp_Object lgstring)
|
|||
/* First we need to break up the glyph string into runs of glyphs that
|
||||
can be treated together. First try a single run. */
|
||||
max_items = 2;
|
||||
items = (SCRIPT_ITEM *) xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1);
|
||||
items = xmalloc (sizeof (SCRIPT_ITEM) * max_items + 1);
|
||||
|
||||
while ((result = ScriptItemize (chars, nchars, max_items, NULL, NULL,
|
||||
items, &nitems)) == E_OUTOFMEMORY)
|
||||
|
|
|
@ -435,7 +435,7 @@ set_frame_size (EmacsFrame ew)
|
|||
flags & XNegative ? '-' : '+', x < 0 ? -x : x,
|
||||
flags & YNegative ? '-' : '+', y < 0 ? -y : y);
|
||||
len = strlen (shell_position) + 1;
|
||||
tem = (char *) xmalloc (len);
|
||||
tem = xmalloc (len);
|
||||
strncpy (tem, shell_position, len);
|
||||
XtVaSetValues (wmshell, XtNgeometry, tem, NULL);
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ set_frame_size (EmacsFrame ew)
|
|||
char *tem;
|
||||
sprintf (shell_position, "=%dx%d", pixel_width, pixel_height);
|
||||
len = strlen (shell_position) + 1;
|
||||
tem = (char *) xmalloc (len);
|
||||
tem = xmalloc (len);
|
||||
strncpy (tem, shell_position, len);
|
||||
XtVaSetValues (wmshell, XtNgeometry, tem, NULL);
|
||||
}
|
||||
|
|
|
@ -29055,7 +29055,7 @@ init_xdisp (void)
|
|||
/* Allocate the buffer for frame titles.
|
||||
Also used for `format-mode-line'. */
|
||||
int size = 100;
|
||||
mode_line_noprop_buf = (char *) xmalloc (size);
|
||||
mode_line_noprop_buf = xmalloc (size);
|
||||
mode_line_noprop_buf_end = mode_line_noprop_buf + size;
|
||||
mode_line_noprop_ptr = mode_line_noprop_buf;
|
||||
mode_line_target = MODE_LINE_DISPLAY;
|
||||
|
|
13
src/xfaces.c
13
src/xfaces.c
|
@ -4148,8 +4148,7 @@ lface_same_font_attributes_p (Lisp_Object *lface1, Lisp_Object *lface2)
|
|||
static struct face *
|
||||
make_realized_face (Lisp_Object *attr)
|
||||
{
|
||||
struct face *face = (struct face *) xmalloc (sizeof *face);
|
||||
memset (face, 0, sizeof *face);
|
||||
struct face *face = xzalloc (sizeof *face);
|
||||
face->ascii_face = face;
|
||||
memcpy (face->lface, attr, sizeof face->lface);
|
||||
return face;
|
||||
|
@ -4294,13 +4293,11 @@ make_face_cache (struct frame *f)
|
|||
struct face_cache *c;
|
||||
int size;
|
||||
|
||||
c = (struct face_cache *) xmalloc (sizeof *c);
|
||||
memset (c, 0, sizeof *c);
|
||||
c = xzalloc (sizeof *c);
|
||||
size = FACE_CACHE_BUCKETS_SIZE * sizeof *c->buckets;
|
||||
c->buckets = (struct face **) xmalloc (size);
|
||||
memset (c->buckets, 0, size);
|
||||
c->buckets = xzalloc (size);
|
||||
c->size = 50;
|
||||
c->faces_by_id = (struct face **) xmalloc (c->size * sizeof *c->faces_by_id);
|
||||
c->faces_by_id = xmalloc (c->size * sizeof *c->faces_by_id);
|
||||
c->f = f;
|
||||
c->menu_face_changed_p = menu_face_changed_default;
|
||||
return c;
|
||||
|
@ -5582,7 +5579,7 @@ realize_non_ascii_face (struct frame *f, Lisp_Object font_object,
|
|||
struct face_cache *cache = FRAME_FACE_CACHE (f);
|
||||
struct face *face;
|
||||
|
||||
face = (struct face *) xmalloc (sizeof *face);
|
||||
face = xmalloc (sizeof *face);
|
||||
*face = *base_face;
|
||||
face->gc = 0;
|
||||
face->extra = NULL;
|
||||
|
|
|
@ -2368,7 +2368,7 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
|
|||
|
||||
{
|
||||
char *str = SSDATA (Vx_resource_name);
|
||||
f->namebuf = (char *) xmalloc (strlen (str) + 1);
|
||||
f->namebuf = xmalloc (strlen (str) + 1);
|
||||
strcpy (f->namebuf, str);
|
||||
}
|
||||
|
||||
|
@ -3129,8 +3129,7 @@ This function is an internal primitive--use `make-frame' instead. */)
|
|||
f->terminal = dpyinfo->terminal;
|
||||
|
||||
f->output_method = output_x_window;
|
||||
f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
|
||||
memset (f->output_data.x, 0, sizeof (struct x_output));
|
||||
f->output_data.x = xzalloc (sizeof (struct x_output));
|
||||
f->output_data.x->icon_bitmap = -1;
|
||||
FRAME_FONTSET (f) = -1;
|
||||
f->output_data.x->scroll_bar_foreground_pixel = -1;
|
||||
|
@ -4615,8 +4614,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
|
|||
from this point on, x_destroy_window might screw up reference
|
||||
counts etc. */
|
||||
f->output_method = output_x_window;
|
||||
f->output_data.x = (struct x_output *) xmalloc (sizeof (struct x_output));
|
||||
memset (f->output_data.x, 0, sizeof (struct x_output));
|
||||
f->output_data.x = xzalloc (sizeof (struct x_output));
|
||||
f->output_data.x->icon_bitmap = -1;
|
||||
FRAME_FONTSET (f) = -1;
|
||||
f->output_data.x->scroll_bar_foreground_pixel = -1;
|
||||
|
|
|
@ -961,7 +961,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
|
|||
else if (!f->output_data.x->saved_menu_event && !deep_p)
|
||||
{
|
||||
deep_p = 1;
|
||||
f->output_data.x->saved_menu_event = (XEvent*)xmalloc (sizeof (XEvent));
|
||||
f->output_data.x->saved_menu_event = xmalloc (sizeof (XEvent));
|
||||
f->output_data.x->saved_menu_event->type = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ x_get_customization_string (XrmDatabase db, const char *name,
|
|||
|
||||
if (result)
|
||||
{
|
||||
char *copy = (char *) xmalloc (strlen (result) + 1);
|
||||
char *copy = xmalloc (strlen (result) + 1);
|
||||
strcpy (copy, result);
|
||||
return copy;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ magic_file_p (const char *string, ptrdiff_t string_len, const char *class,
|
|||
char *lang = getenv ("LANG");
|
||||
|
||||
ptrdiff_t path_size = 100;
|
||||
char *path = (char *) xmalloc (path_size);
|
||||
char *path = xmalloc (path_size);
|
||||
ptrdiff_t path_len = 0;
|
||||
|
||||
const char *p = string;
|
||||
|
@ -258,7 +258,7 @@ gethomedir (void)
|
|||
if (ptr == NULL)
|
||||
return xstrdup ("/");
|
||||
|
||||
copy = (char *) xmalloc (strlen (ptr) + 2);
|
||||
copy = xmalloc (strlen (ptr) + 2);
|
||||
strcpy (copy, ptr);
|
||||
strcat (copy, "/");
|
||||
|
||||
|
@ -400,7 +400,7 @@ get_user_db (Display *display)
|
|||
char *xdefault;
|
||||
|
||||
home = gethomedir ();
|
||||
xdefault = (char *) xmalloc (strlen (home) + sizeof (".Xdefaults"));
|
||||
xdefault = xmalloc (strlen (home) + sizeof (".Xdefaults"));
|
||||
strcpy (xdefault, home);
|
||||
strcat (xdefault, ".Xdefaults");
|
||||
db = XrmGetFileDatabase (xdefault);
|
||||
|
|
|
@ -180,16 +180,11 @@ x_queue_event (struct input_event *event)
|
|||
}
|
||||
}
|
||||
|
||||
queue_tmp
|
||||
= (struct selection_event_queue *) xmalloc (sizeof (struct selection_event_queue));
|
||||
|
||||
if (queue_tmp != NULL)
|
||||
{
|
||||
TRACE1 ("QUEUE SELECTION EVENT %p", queue_tmp);
|
||||
queue_tmp->event = *event;
|
||||
queue_tmp->next = selection_queue;
|
||||
selection_queue = queue_tmp;
|
||||
}
|
||||
queue_tmp = xmalloc (sizeof (struct selection_event_queue));
|
||||
TRACE1 ("QUEUE SELECTION EVENT %p", queue_tmp);
|
||||
queue_tmp->event = *event;
|
||||
queue_tmp->next = selection_queue;
|
||||
selection_queue = queue_tmp;
|
||||
}
|
||||
|
||||
/* Start queuing SELECTION_REQUEST_EVENT events. */
|
||||
|
@ -1085,7 +1080,7 @@ static struct prop_location *
|
|||
expect_property_change (Display *display, Window window,
|
||||
Atom property, int state)
|
||||
{
|
||||
struct prop_location *pl = (struct prop_location *) xmalloc (sizeof *pl);
|
||||
struct prop_location *pl = xmalloc (sizeof *pl);
|
||||
pl->identifier = ++prop_location_identifier;
|
||||
pl->display = display;
|
||||
pl->window = window;
|
||||
|
@ -1446,7 +1441,7 @@ receive_incremental_selection (Display *display, Window window, Atom property,
|
|||
struct prop_location *wait_object;
|
||||
if (min (PTRDIFF_MAX, SIZE_MAX) < min_size_bytes)
|
||||
memory_full (SIZE_MAX);
|
||||
*data_ret = (unsigned char *) xmalloc (min_size_bytes);
|
||||
*data_ret = xmalloc (min_size_bytes);
|
||||
*size_bytes_ret = min_size_bytes;
|
||||
|
||||
TRACE1 ("Read %u bytes incrementally", min_size_bytes);
|
||||
|
@ -1780,7 +1775,7 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
|
|||
}
|
||||
else if (SYMBOLP (obj))
|
||||
{
|
||||
*data_ret = (unsigned char *) xmalloc (sizeof (Atom) + 1);
|
||||
*data_ret = xmalloc (sizeof (Atom) + 1);
|
||||
*format_ret = 32;
|
||||
*size_ret = 1;
|
||||
(*data_ret) [sizeof (Atom)] = 0;
|
||||
|
@ -1789,7 +1784,7 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
|
|||
}
|
||||
else if (RANGED_INTEGERP (X_SHRT_MIN, obj, X_SHRT_MAX))
|
||||
{
|
||||
*data_ret = (unsigned char *) xmalloc (sizeof (short) + 1);
|
||||
*data_ret = xmalloc (sizeof (short) + 1);
|
||||
*format_ret = 16;
|
||||
*size_ret = 1;
|
||||
(*data_ret) [sizeof (short)] = 0;
|
||||
|
@ -1802,7 +1797,7 @@ lisp_data_to_selection_data (Display *display, Lisp_Object obj,
|
|||
|| (CONSP (XCDR (obj))
|
||||
&& INTEGERP (XCAR (XCDR (obj)))))))
|
||||
{
|
||||
*data_ret = (unsigned char *) xmalloc (sizeof (unsigned long) + 1);
|
||||
*data_ret = xmalloc (sizeof (unsigned long) + 1);
|
||||
*format_ret = 32;
|
||||
*size_ret = 1;
|
||||
(*data_ret) [sizeof (unsigned long)] = 0;
|
||||
|
|
23
src/xterm.c
23
src/xterm.c
|
@ -5777,9 +5777,9 @@ static struct x_display_info *next_noop_dpyinfo;
|
|||
do \
|
||||
{ \
|
||||
if (f->output_data.x->saved_menu_event == 0) \
|
||||
f->output_data.x->saved_menu_event \
|
||||
= (XEvent *) xmalloc (sizeof (XEvent)); \
|
||||
*f->output_data.x->saved_menu_event = event; \
|
||||
f->output_data.x->saved_menu_event = \
|
||||
xmalloc (sizeof (XEvent)); \
|
||||
*f->output_data.x->saved_menu_event = event; \
|
||||
inev.ie.kind = MENU_BAR_ACTIVATE_EVENT; \
|
||||
XSETFRAME (inev.ie.frame_or_window, f); \
|
||||
} \
|
||||
|
@ -8190,11 +8190,11 @@ xim_initialize (struct x_display_info *dpyinfo, char *resource_name)
|
|||
struct xim_inst_t *xim_inst;
|
||||
ptrdiff_t len;
|
||||
|
||||
xim_inst = (struct xim_inst_t *) xmalloc (sizeof (struct xim_inst_t));
|
||||
xim_inst = xmalloc (sizeof (struct xim_inst_t));
|
||||
dpyinfo->xim_callback_data = xim_inst;
|
||||
xim_inst->dpyinfo = dpyinfo;
|
||||
len = strlen (resource_name);
|
||||
xim_inst->resource_name = (char *) xmalloc (len + 1);
|
||||
xim_inst->resource_name = xmalloc (len + 1);
|
||||
memcpy (xim_inst->resource_name, resource_name, len + 1);
|
||||
XRegisterIMInstantiateCallback (dpyinfo->display, dpyinfo->xrdb,
|
||||
resource_name, emacs_class,
|
||||
|
@ -10098,8 +10098,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
|
||||
/* We have definitely succeeded. Record the new connection. */
|
||||
|
||||
dpyinfo = (struct x_display_info *) xmalloc (sizeof (struct x_display_info));
|
||||
memset (dpyinfo, 0, sizeof *dpyinfo);
|
||||
dpyinfo = xzalloc (sizeof (struct x_display_info));
|
||||
hlinfo = &dpyinfo->mouse_highlight;
|
||||
|
||||
terminal = x_create_terminal (dpyinfo);
|
||||
|
@ -10117,7 +10116,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
terminal->kboard = share->terminal->kboard;
|
||||
else
|
||||
{
|
||||
terminal->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
|
||||
terminal->kboard = xmalloc (sizeof (KBOARD));
|
||||
init_kboard (terminal->kboard);
|
||||
KVAR (terminal->kboard, Vwindow_system) = Qx;
|
||||
|
||||
|
@ -10171,7 +10170,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
dpyinfo->display = dpy;
|
||||
|
||||
/* Set the name of the terminal. */
|
||||
terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
|
||||
terminal->name = xmalloc (SBYTES (display_name) + 1);
|
||||
memcpy (terminal->name, SSDATA (display_name), SBYTES (display_name));
|
||||
terminal->name[SBYTES (display_name)] = 0;
|
||||
|
||||
|
@ -10182,10 +10181,8 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
|
|||
lim = min (PTRDIFF_MAX, SIZE_MAX) - sizeof "@";
|
||||
if (lim - SBYTES (Vinvocation_name) < SBYTES (Vsystem_name))
|
||||
memory_full (SIZE_MAX);
|
||||
dpyinfo->x_id_name
|
||||
= (char *) xmalloc (SBYTES (Vinvocation_name)
|
||||
+ SBYTES (Vsystem_name)
|
||||
+ 2);
|
||||
dpyinfo->x_id_name = xmalloc (SBYTES (Vinvocation_name)
|
||||
+ SBYTES (Vsystem_name) + 2);
|
||||
strcat (strcat (strcpy (dpyinfo->x_id_name, SSDATA (Vinvocation_name)), "@"),
|
||||
SSDATA (Vsystem_name));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue