]> code.delx.au - gnu-emacs/blobdiff - src/sound.c
Ibuffer change marks
[gnu-emacs] / src / sound.c
index b49348f1256a1b0a0050cf48bb103eb09aec0830..f5f570190ca9899bc3c5d129caa8a04bf0bebf34 100644 (file)
@@ -1,13 +1,13 @@
 /* sound.c -- sound support.
 
-Copyright (C) 1998-1999, 2001-2014 Free Software Foundation, Inc.
+Copyright (C) 1998-1999, 2001-2016 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -46,7 +46,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include <errno.h>
 
 #include "lisp.h"
-#include "dispextern.h"
 #include "atimer.h"
 #include "syssignal.h"
 /* END: Common Includes */
@@ -99,12 +98,6 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* BEGIN: Common Definitions */
 
-/* Symbols.  */
-
-static Lisp_Object QCvolume, QCdevice;
-static Lisp_Object Qsound;
-static Lisp_Object Qplay_sound_functions;
-
 /* Indices of attributes in a sound attributes vector.  */
 
 enum sound_attr
@@ -317,12 +310,13 @@ sound_perror (const char *msg)
   }
 #endif
   if (saved_errno != 0)
-    error ("%s: %s", msg, strerror (saved_errno));
+    error ("%s: %s", msg, emacs_strerror (saved_errno));
   else
     error ("%s", msg);
 }
 
 
+#ifndef WINDOWSNT
 /* Display a warning message.  */
 
 static void
@@ -330,6 +324,7 @@ sound_warning (const char *msg)
 {
   message1 (msg);
 }
+#endif /* !WINDOWSNT */
 
 
 /* Parse sound specification SOUND, and fill ATTRS with what is
@@ -1357,9 +1352,6 @@ Internal use only, use `play-sound' instead.  */)
 {
   Lisp_Object attrs[SOUND_ATTR_SENTINEL];
   ptrdiff_t count = SPECPDL_INDEX ();
-  Lisp_Object file;
-  Lisp_Object args[2];
-  struct gcpro gcpro1, gcpro2;
 
 #ifdef WINDOWSNT
   unsigned long ui_volume_tmp = UINT_MAX;
@@ -1370,9 +1362,9 @@ Internal use only, use `play-sound' instead.  */)
   if (!parse_sound (sound, attrs))
     error ("Invalid sound specification");
 
+  Lisp_Object file = Qnil;
+
 #ifndef WINDOWSNT
-  file = Qnil;
-  GCPRO2 (sound, file);
   current_sound_device = xzalloc (sizeof *current_sound_device);
   current_sound = xzalloc (sizeof *current_sound);
   record_unwind_protect_void (sound_cleanup);
@@ -1413,9 +1405,7 @@ Internal use only, use `play-sound' instead.  */)
   else if (FLOATP (attrs[SOUND_VOLUME]))
     current_sound_device->volume = XFLOAT_DATA (attrs[SOUND_VOLUME]) * 100;
 
-  args[0] = Qplay_sound_functions;
-  args[1] = sound;
-  Frun_hook_with_args (2, args);
+  CALLN (Frun_hook_with_args, Qplay_sound_functions, sound);
 
 #ifdef HAVE_ALSA
   if (!alsa_init (current_sound_device))
@@ -1429,9 +1419,6 @@ Internal use only, use `play-sound' instead.  */)
   /* Play the sound.  */
   current_sound->play (current_sound, current_sound_device);
 
-  /* Clean up.  */
-  UNGCPRO;
-
 #else /* WINDOWSNT */
 
   file = Fexpand_file_name (attrs[SOUND_FILE], Vdata_directory);
@@ -1445,11 +1432,7 @@ Internal use only, use `play-sound' instead.  */)
       ui_volume_tmp = XFLOAT_DATA (attrs[SOUND_VOLUME]) * 100;
     }
 
-  GCPRO2 (sound, file);
-
-  args[0] = Qplay_sound_functions;
-  args[1] = sound;
-  Frun_hook_with_args (2, args);
+  CALLN (Frun_hook_with_args, Qplay_sound_functions, sound);
 
   /*
     Based on some experiments I have conducted, a value of 100 or less
@@ -1466,12 +1449,9 @@ Internal use only, use `play-sound' instead.  */)
     }
   (void)do_play_sound (SSDATA (file), ui_volume);
 
-  UNGCPRO;
-
 #endif /* WINDOWSNT */
 
-  unbind_to (count, Qnil);
-  return Qnil;
+  return unbind_to (count, Qnil);
 }
 \f
 /***********************************************************************