]> git.tue.mpg.de Git - paraslash.git/commitdiff
simplify setup_default_wng()
authorAndre Noll <maan@systemlinux.org>
Mon, 19 Feb 2007 21:19:20 +0000 (22:19 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 19 Feb 2007 21:19:20 +0000 (22:19 +0100)
The default writer is known at compile time, so replace the code
that computes it at runtime by a #define in configure.ac.

configure.ac
write_common.c

index 1fa5ac4f2f71c9fe949862278e25a51a8a5b0fb5..cb7ad163536eaaf8c7edfdaa4618248702e612f3 100644 (file)
@@ -93,6 +93,7 @@ write_cmdline_objs="write.cmdline file_write.cmdline"
 write_errlist_objs="write write_common file_write time fd string sched stdin"
 write_ldflags=""
 writers=" file"
+default_writer="FILE_WRITE"
 
 client_cmdline_objs="client.cmdline"
 client_errlist_objs="client net string crypt fd sched stdin stdout client_common"
@@ -184,6 +185,7 @@ if test ${have_core_audio} = yes; then
        write_cmdline_objs="$write_cmdline_objs osx_write.cmdline"
        write_ldflags="$write_ldflags $f"
        writers="$writers osx"
+       default_writer="OSX_WRITE"
        AC_DEFINE(HAVE_CORE_AUDIO, 1, define to 1 on Mac Os X)
 fi
 ########################################################################### gtk2
@@ -405,6 +407,7 @@ if test "$have_alsa" = "yes"; then
        write_cmdline_objs="$write_cmdline_objs alsa_write.cmdline"
        write_ldflags="$write_ldflags -lasound"
        writers="$writers alsa"
+       default_writer="ALSA_WRITE"
 fi
 CPPFLAGS="$OLD_CPPFLAGS"
 LDFLAGS="$OLD_LDFLAGS"
@@ -532,6 +535,7 @@ AC_DEFINE_UNQUOTED(INIT_AUDIOC_ERRLISTS,
 enum="$(for i in $writers; do printf "${i}_WRITE, " | tr '[a-z]' '[A-Z]'; done)"
 AC_DEFINE_UNQUOTED(WRITER_ENUM, $enum NUM_SUPPORTED_WRITERS,
        enum of supported writers)
+AC_DEFINE_UNQUOTED(DEFAULT_WRITER, $default_writer, use this writer if none was specified)
 names="$(for i in $writers; do printf \"$i\",' ' ; done)"
 AC_DEFINE_UNQUOTED(WRITER_NAMES, $names, supported writer names)
 inits="$(for i in $writers; do printf 'extern void '$i'_write_init(struct writer *); '; done)"
index ac92bc1a1740d1eeefa50551d03744a6018fce41..78d1523e2c14cd95afb00fab6a58aa50a49a908e 100644 (file)
@@ -236,15 +236,9 @@ void *check_writer_arg(const char *wa, int *writer_num)
 struct writer_node_group *setup_default_wng(void)
 {
        struct writer_node_group *wng = wng_new(1);
-       enum writer_enum default_writer;
-
-       if (NUM_SUPPORTED_WRITERS == 1)
-               default_writer = FILE_WRITE;
-       else
-               default_writer = 1;
-       wng->writer_nodes[0].writer = &writers[default_writer];
+       wng->writer_nodes[0].writer = &writers[DEFAULT_WRITER];
        PARA_INFO_LOG("using default writer: %s %p\n",
-               writer_names[default_writer], writers[default_writer].parse_config);
-       wng->writer_nodes[0].conf = writers[default_writer].parse_config("");
+               writer_names[DEFAULT_WRITER], writers[DEFAULT_WRITER].parse_config);
+       wng->writer_nodes[0].conf = writers[DEFAULT_WRITER].parse_config("");
        return wng;
 }