X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/58f2d6ef32b28a787fcc4e0d98b3f331ceb2a68c..d6640d6e4c4f1a85edf924bca0f8a90d1aa6341a:/src/sound.c diff --git a/src/sound.c b/src/sound.c index 6f7e2adecc..05c7b06010 100644 --- a/src/sound.c +++ b/src/sound.c @@ -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); } /***********************************************************************