summaryrefslogtreecommitdiff
path: root/src/xfaces.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-07-05 10:32:41 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-07-05 10:32:41 +0400
commit23f86fce48e1cc8118f0ea5cce49d1acfd4364c4 (patch)
tree837ae05f1ad4ad92936f804d580d95751779befe /src/xfaces.c
parent0497dc44b44f148425ff76c4cb7ef0d2ead9750b (diff)
downloademacs-23f86fce48e1cc8118f0ea5cce49d1acfd4364c4.tar.gz
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.
Diffstat (limited to 'src/xfaces.c')
-rw-r--r--src/xfaces.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/xfaces.c b/src/xfaces.c
index 021d40559e5..28ef5e6cd13 100644
--- a/src/xfaces.c
+++ b/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;