diff --git a/src/Stream.c b/src/Stream.c index ee34fab..521ef66 100644 --- a/src/Stream.c +++ b/src/Stream.c @@ -97,17 +97,9 @@ StreamFd(int fd) } Stream * -StreamOpen(const char *path, const char *mode) +StreamFile(FILE *fp) { - FILE *fp = fopen(path, mode); - Io *io; - - if (!fp) - { - return NULL; - } - - io = IoFile(fp); + Io *io = IoFile(fp); if (!io) { @@ -117,6 +109,19 @@ StreamOpen(const char *path, const char *mode) return StreamIo(io); } +Stream * +StreamOpen(const char *path, const char *mode) +{ + FILE *fp = fopen(path, mode); + + if (!fp) + { + return NULL; + } + + return StreamFile(fp); +} + int StreamClose(Stream * stream) { diff --git a/src/include/Stream.h b/src/include/Stream.h index 2c9698b..2fcc83b 100644 --- a/src/include/Stream.h +++ b/src/include/Stream.h @@ -36,6 +36,9 @@ extern Stream * extern Stream * StreamFd(int); +extern Stream * + StreamFile(FILE *); + extern Stream * StreamOpen(const char *, const char *);