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/sound.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/sound.c')
-rw-r--r-- | src/sound.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/sound.c b/src/sound.c index e28e8c69f11..adeb3c47f0f 100644 --- a/src/sound.c +++ b/src/sound.c @@ -594,7 +594,7 @@ wav_play (struct sound *s, struct sound_device *sd) ptrdiff_t blksize = sd->period_size ? sd->period_size (sd) : 2048; ptrdiff_t data_left = header->data_length; - buffer = (char *) alloca (blksize); + buffer = alloca (blksize); lseek (s->fd, sizeof *header, SEEK_SET); while (data_left > 0 && (nbytes = emacs_read (s->fd, buffer, blksize)) > 0) @@ -688,7 +688,7 @@ au_play (struct sound *s, struct sound_device *sd) lseek (s->fd, header->data_offset, SEEK_SET); /* Copy sound data to the device. */ - buffer = (char *) alloca (blksize); + buffer = alloca (blksize); while ((nbytes = emacs_read (s->fd, buffer, blksize)) > 0) sd->write (sd, buffer, nbytes); @@ -932,7 +932,7 @@ alsa_open (struct sound_device *sd) else file = DEFAULT_ALSA_SOUND_DEVICE; - p = xmalloc (sizeof (*p)); + p = xmalloc (sizeof *p); p->handle = NULL; p->hwparams = NULL; p->swparams = NULL; @@ -1364,10 +1364,10 @@ Internal use only, use `play-sound' instead. */) #ifndef WINDOWSNT file = Qnil; GCPRO2 (sound, file); - current_sound_device = xzalloc (sizeof (struct sound_device)); - current_sound = xzalloc (sizeof (struct sound)); + current_sound_device = xzalloc (sizeof *current_sound_device); + current_sound = xzalloc (sizeof *current_sound); record_unwind_protect (sound_cleanup, Qnil); - current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); + current_sound->header = alloca (MAX_SOUND_HEADER_BYTES); if (STRINGP (attrs[SOUND_FILE])) { @@ -1399,7 +1399,7 @@ Internal use only, use `play-sound' instead. */) if (STRINGP (attrs[SOUND_DEVICE])) { int len = SCHARS (attrs[SOUND_DEVICE]); - current_sound_device->file = (char *) alloca (len + 1); + current_sound_device->file = alloca (len + 1); strcpy (current_sound_device->file, SSDATA (attrs[SOUND_DEVICE])); } @@ -1431,7 +1431,7 @@ Internal use only, use `play-sound' instead. */) lo_file = Fexpand_file_name (attrs[SOUND_FILE], Qnil); len = XSTRING (lo_file)->size; - psz_file = (char *) alloca (len + 1); + psz_file = alloca (len + 1); strcpy (psz_file, XSTRING (lo_file)->data); if (INTEGERP (attrs[SOUND_VOLUME])) { |