Changeset: 8ef9d83cf52d for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=8ef9d83cf52d Modified Files: common/stream/stream.c Branch: default Log Message:
Move functions. diffs (91 lines): diff --git a/common/stream/stream.c b/common/stream/stream.c --- a/common/stream/stream.c +++ b/common/stream/stream.c @@ -1826,43 +1826,6 @@ open_wastream(const char *filename) return s; } -/* some lower-level access functions */ -FILE * -getFile(stream *s) -{ -#ifdef _MSC_VER - if (s->read == console_read) - return stdin; - if (s->write == console_write) - return stdout; -#endif - if (s->read != file_read) - return NULL; - return (FILE *) s->stream_data.p; -} - -int -getFileNo(stream *s) -{ - FILE *f; - - f = getFile(s); - if (f == NULL) - return -1; - return fileno(f); -} - -size_t -getFileSize(stream *s) -{ - struct stat stb; - int fd = getFileNo(s); - - if (fd >= 0 && fstat(fd, &stb) == 0) - return (size_t) stb.st_size; - return 0; /* unknown */ -} - /* ------------------------------------------------------------------ */ /* streams working on a remote file using cURL */ @@ -2804,6 +2767,43 @@ file_wastream(FILE *restrict fp, const c return s; } +/* some lower-level access functions */ +FILE * +getFile(stream *s) +{ +#ifdef _MSC_VER + if (s->read == console_read) + return stdin; + if (s->write == console_write) + return stdout; +#endif + if (s->read != file_read) + return NULL; + return (FILE *) s->stream_data.p; +} + +int +getFileNo(stream *s) +{ + FILE *f; + + f = getFile(s); + if (f == NULL) + return -1; + return fileno(f); +} + +size_t +getFileSize(stream *s) +{ + struct stat stb; + int fd = getFileNo(s); + + if (fd >= 0 && fstat(fd, &stb) == 0) + return (size_t) stb.st_size; + return 0; /* unknown */ +} + /* ------------------------------------------------------------------ */ /* streams working on a substream, converting character sets using iconv */ _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list