]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Change the ->open method of writers to void.
authorAndre Noll <maan@systemlinux.org>
Thu, 4 Nov 2010 22:54:23 +0000 (23:54 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 23 Nov 2010 16:42:05 +0000 (17:42 +0100)
These methods always succeed. Add missing documentation of the public
register_writer_node() function while we're at it.

alsa_write.c
file_write.c
oss_write.c
osx_write.c
write.h
write_common.c

index aa772daaae48bbd135d222b0eca3d70543d3060c..b685e4f79b039010a439503095adaf00f9187c6b 100644 (file)
@@ -143,10 +143,9 @@ static int alsa_init(struct private_alsa_write_data *pad,
 }
 
 /* Open an instance of the alsa writer. */
-static int alsa_open(struct writer_node *wn)
+static void alsa_open(struct writer_node *wn)
 {
        wn->private_data = para_calloc(sizeof(struct private_alsa_write_data));
-       return 1;
 }
 
 static void alsa_write_pre_select(struct sched *s, struct task *t)
index 7497dfaa0f00e6be8c8856a2659bcaaa65938100..7bc1e437ea8975a2e97221754a85b00577e4bef4 100644 (file)
@@ -50,13 +50,12 @@ __must_check __malloc static char *random_filename(void)
        return result;
 }
 
-static int file_write_open(struct writer_node *wn)
+static void file_write_open(struct writer_node *wn)
 {
        struct private_file_write_data *pfwd = para_calloc(sizeof(*pfwd));
 
        wn->private_data = pfwd;
        pfwd->fd = -1;
-       return 0;
 }
 
 static int prepare_output_file(struct writer_node *wn)
index 5bc41bccad2ca1cd7cada87fac8e6355476cf81d..2d820d33e8e8bbccd313af6659ecf42d6d5280b9 100644 (file)
@@ -199,14 +199,12 @@ out:
                btr_remove_node(btrn);
 }
 
-static int oss_open(struct writer_node *wn)
+static void oss_open(struct writer_node *wn)
 {
-       struct private_oss_write_data *powd;
+       struct private_oss_write_data *powd = para_calloc(sizeof(*powd));
 
-       powd = para_calloc(sizeof(*powd));
-       wn->private_data = powd;
        powd->fd = -1;
-       return 1;
+       wn->private_data = powd;
 }
 
 __malloc static void *oss_parse_config_or_die(const char *options)
index b0dfa89b17795007de8b3d85a8d63f7636bc5ecf..c2b7b2f48aef0de6bdf6a08c2e86269698590fd9 100644 (file)
@@ -187,13 +187,12 @@ static OSStatus osx_callback(void * inClientData,
 #define ENDIAN_FLAGS 0
 #endif
 
-static int osx_write_open(struct writer_node *wn)
+static void osx_write_open(struct writer_node *wn)
 {
        struct private_osx_write_data *powd = para_calloc(sizeof(*powd));
 
        wn->private_data = powd;
        init_buffers(wn);
-       return 0;
 }
 
 static int core_audio_init(struct writer_node *wn)
diff --git a/write.h b/write.h
index fd0f4f6ba7b42b186eab05efbc5ee61cdf499140..da6f1e75aabfe2ceac26e9d4c7074e243b9829c9 100644 (file)
--- a/write.h
+++ b/write.h
@@ -53,11 +53,13 @@ struct writer {
        /**
         * Open one instance of this writer.
         *
-        * This function should perform any work necessary to write the incoming
-        * stream. To this aim, it may allocate its private data structure and store
-        * a pointer to that structure via the given writer_node parameter.
+        * Perform any preparations needed to write the incoming stream.
+        * Usually this function just allocates its private data structure and
+        * stores a pointer to that structure in the ->private data of the
+        * given parameter. This function must either succeed or terminate the
+        * process.
         */
-       int (*open)(struct writer_node *);
+       void (*open)(struct writer_node *);
        /**
         * Prepare the fd sets for select.
         *
index fb7f4775111009158cbb2ba4836caddbe6247697..5bfba37d9197b7910046fa9efd6685167166164b 100644 (file)
@@ -73,18 +73,26 @@ void *check_writer_arg(const char *wa, int *writer_num)
        return NULL;
 }
 
+/**
+ * Open a writer node and register the corresponding task.
+ *
+ * \param wn The writer node to open.
+ * \param parent The parent btr node (the source for the writer node).
+ *
+ * The configuration of the writer node stored in \p wn->conf must be
+ * initialized before this function may be called.
+ */
 void register_writer_node(struct writer_node *wn, struct btr_node *parent)
 {
        struct writer *w = writers + wn->writer_num;
        char *name = make_message("%s writer", writer_names[wn->writer_num]);
-       int ret;
 
        wn->btrn = btr_new_node(&(struct btr_node_description)
                EMBRACE(.name = name, .parent = parent,
                .handler = w->execute, .context = wn));
        strcpy(wn->task.status, name);
        free(name);
-       ret = w->open(wn);
+       w->open(wn);
        wn->task.post_select = w->post_select;
        wn->task.pre_select = w->pre_select;
        register_task(&wn->task);