From 6422607b1faa4fa54a49eb83d910f87bffdbb636 Mon Sep 17 00:00:00 2001 From: Moritz Grimm Date: Thu, 28 May 2015 08:34:01 +0200 Subject: [PATCH] Expect stat() availability --- src/metadata.c | 13 ------------- src/playlist.c | 23 +++++++++-------------- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/src/metadata.c b/src/metadata.c index 93c74fc..b8817f6 100644 --- a/src/metadata.c +++ b/src/metadata.c @@ -353,17 +353,12 @@ metadata_t * metadata_program(const char *program, int normalize) { metadata_t *md; -#ifdef HAVE_STAT struct stat st; -#else - FILE *filep; -#endif md = metadata_create(program); md->program = 1; md->string = xstrdup(""); -#ifdef HAVE_STAT if (stat(program, &st) == -1) { log_error("%s: %s", program, strerror(errno)); metadata_free(&md); @@ -380,14 +375,6 @@ metadata_program(const char *program, int normalize) metadata_free(&md); return (NULL); } -#else - if ((filep = fopen(program, "r")) == NULL) { - log_error("%s: %s", program, strerror(errno)); - metadata_free(&md); - return (NULL); - } - fclose(filep); -#endif /* HAVE_STAT */ md->normalize = normalize; diff --git a/src/playlist.c b/src/playlist.c index ace11d2..8c500db 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -18,7 +18,15 @@ # include "config.h" #endif -#include "ezstream.h" +#include + +#include +#include +#include +#include +#include +#include +#include #include "log.h" #include "playlist.h" @@ -255,16 +263,11 @@ struct playlist * playlist_program(const char *filename) { struct playlist *pl; -#ifdef HAVE_STAT struct stat st; -#else - FILE *filep; -#endif pl = _playlist_create(filename); pl->program = 1; -#ifdef HAVE_STAT if (stat(filename, &st) == -1) { log_error("%s: %s", filename, strerror(errno)); playlist_free(&pl); @@ -281,14 +284,6 @@ playlist_program(const char *filename) playlist_free(&pl); return (NULL); } -#else - if ((filep = fopen(filename, "r")) == NULL) { - log_error("%s: %s", filename, strerror(errno)); - playlist_free(&pl); - return (NULL); - } - fclose(filep); -#endif /* HAVE_STAT */ return (pl); }