]> code.delx.au - gnu-emacs/blobdiff - src/sound.c
Give names to Unicode code points in C code
[gnu-emacs] / src / sound.c
index 6f7e2adecc966209556263829a13f5f39cb5ea23..05c7b0601043343b4679a807b36f759f0547a41b 100644 (file)
@@ -1351,8 +1351,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
@@ -1364,9 +1362,10 @@ Internal use only, use `play-sound' instead.  */)
   if (!parse_sound (sound, attrs))
     error ("Invalid sound specification");
 
-#ifndef WINDOWSNT
-  file = Qnil;
+  Lisp_Object file = Qnil;
   GCPRO2 (sound, file);
+
+#ifndef WINDOWSNT
   current_sound_device = xzalloc (sizeof *current_sound_device);
   current_sound = xzalloc (sizeof *current_sound);
   record_unwind_protect_void (sound_cleanup);
@@ -1407,9 +1406,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))
@@ -1423,9 +1420,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);
@@ -1439,11 +1433,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
@@ -1460,12 +1450,10 @@ Internal use only, use `play-sound' instead.  */)
     }
   (void)do_play_sound (SSDATA (file), ui_volume);
 
-  UNGCPRO;
-
 #endif /* WINDOWSNT */
 
-  unbind_to (count, Qnil);
-  return Qnil;
+  UNGCPRO;
+  return unbind_to (count, Qnil);
 }
 \f
 /***********************************************************************