diff options
author | David Robillard <d@drobilla.net> | 2011-12-11 22:11:22 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-12-11 22:11:22 +0000 |
commit | ea1936a594d7e4e656731223b76d355fc5431ef9 (patch) | |
tree | 87393e02793fba4cd44fb8da2db83f24380b509a /src/serdi.c | |
parent | e08decb5992d6511e6896939a4cd9ad157831b78 (diff) | |
download | serd-ea1936a594d7e4e656731223b76d355fc5431ef9.tar.gz serd-ea1936a594d7e4e656731223b76d355fc5431ef9.tar.bz2 serd-ea1936a594d7e4e656731223b76d355fc5431ef9.zip |
Move all #ifdef gunk to serd_internal.h.
Centralise file open and buffer allocation to localize platform tweaks.
git-svn-id: http://svn.drobilla.net/serd/trunk@244 490d8e77-9747-427b-9fa3-0b8f29cee8a0
Diffstat (limited to 'src/serdi.c')
-rw-r--r-- | src/serdi.c | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/src/serdi.c b/src/serdi.c index b3261eac..dca821bb 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -14,22 +14,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#define _POSIX_C_SOURCE 201112L /* for posix_memalign */ +#include "serd_internal.h" #include <assert.h> #include <errno.h> #include <stdlib.h> #include <string.h> -#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO) -# include <fcntl.h> -#endif - -#include "serd/serd.h" - -#include "serd-config.h" -#include "serd_internal.h" - typedef struct { SerdEnv* env; SerdWriter* writer; @@ -176,15 +167,9 @@ main(int argc, char** argv) input += 5; } } - in_fd = fopen((const char*)input, "r"); - if (!in_fd) { - fprintf(stderr, "Error opening file %s (%s)\n", - input, strerror(errno)); + if (!(in_fd = serd_fopen((const char*)input, "r"))) { return 1; } -#if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO) - posix_fadvise(fileno(in_fd), 0, 0, POSIX_FADV_SEQUENTIAL); -#endif } } |