From 464b6117721056e72c79824a298caf53eb5cd452 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 26 Oct 2008 20:54:52 +0100 Subject: input_stream: input_stream_close() returns void close() shouldn't fail with read-only streams. --- src/input_curl.c | 3 +-- src/input_file.c | 9 ++------- src/input_stream.c | 4 ++-- src/input_stream.h | 4 ++-- 4 files changed, 7 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/input_curl.c b/src/input_curl.c index 09e73c3e2..e34ef5e22 100644 --- a/src/input_curl.c +++ b/src/input_curl.c @@ -235,11 +235,10 @@ input_curl_read(struct input_stream *is, void *ptr, size_t size) return nbytes; } -static int +static void input_curl_close(struct input_stream *is) { input_curl_free(is); - return 0; } static int diff --git a/src/input_file.c b/src/input_file.c index a176d55f2..5c3ff6ad0 100644 --- a/src/input_file.c +++ b/src/input_file.c @@ -78,15 +78,10 @@ input_file_read(struct input_stream *is, void *ptr, size_t size) return readSize; } -static int +static void input_file_close(struct input_stream *is) { - if (fclose((FILE *) is->data) < 0) { - is->error = errno; - return -1; - } - - return 0; + fclose((FILE *) is->data); } static int diff --git a/src/input_stream.c b/src/input_stream.c index a5c55fa54..957ca113f 100644 --- a/src/input_stream.c +++ b/src/input_stream.c @@ -85,7 +85,7 @@ input_stream_read(struct input_stream *is, void *ptr, size_t size) return is->plugin->read(is, ptr, size); } -int input_stream_close(struct input_stream *is) +void input_stream_close(struct input_stream *is) { if (is->mime) free(is->mime); @@ -94,7 +94,7 @@ int input_stream_close(struct input_stream *is) if (is->meta_title) free(is->meta_title); - return is->plugin->close(is); + is->plugin->close(is); } int input_stream_eof(struct input_stream *is) diff --git a/src/input_stream.h b/src/input_stream.h index b2887e10d..3fc6d942f 100644 --- a/src/input_stream.h +++ b/src/input_stream.h @@ -26,7 +26,7 @@ struct input_stream; struct input_plugin { bool (*open)(struct input_stream *is, const char *url); - int (*close)(struct input_stream *is); + void (*close)(struct input_stream *is); int (*buffer)(struct input_stream *is); size_t (*read)(struct input_stream *is, void *ptr, size_t size); @@ -58,7 +58,7 @@ void input_stream_global_finish(void); for the input stream is set */ int input_stream_open(struct input_stream *is, char *url); int input_stream_seek(struct input_stream *is, long offset, int whence); -int input_stream_close(struct input_stream *is); +void input_stream_close(struct input_stream *is); int input_stream_eof(struct input_stream *is); /* return value: -1 is error, 1 inidicates stuff was buffered, 0 means nothing -- cgit v1.2.3