Index: src/file.c ================================================================== --- src/file.c +++ src/file.c @@ -55,11 +55,11 @@ #define DEFAULT_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH struct CFWFile { CFWStream stream; int fd; - bool eof; + bool at_end; }; static int parse_mode(const char *mode) { @@ -96,11 +96,11 @@ { CFWFile *file = ptr; ssize_t ret; if ((ret = read(file->fd, buf, len)) == 0) - file->eof = true; + file->at_end = true; return ret; } static bool @@ -114,15 +114,15 @@ return true; } static bool -file_eof(void *ptr) +file_at_end(void *ptr) { CFWFile *file = ptr; - return file->eof; + return file->at_end; } static void file_close(void *ptr) { @@ -132,11 +132,11 @@ } static struct cfw_stream_ops stream_ops = { .read = file_read, .write = file_write, - .eof = file_eof, + .at_end = file_at_end, .close = file_close }; static bool ctor(void *ptr, va_list args) @@ -146,11 +146,11 @@ const char *mode = va_arg(args, const char*); int flags; /* Make sure we have a valid file in case we error out */ cfw_stream->ctor(ptr, args); - file->eof = false; + file->at_end = false; if ((flags = parse_mode(mode)) == -1) return false; if ((file->fd = open(path, flags, DEFAULT_MODE)) == -1) @@ -182,11 +182,11 @@ .ref_cnt = INT_MAX }, .ops = &stream_ops }, .fd = 0, - .eof = false + .at_end = false }; static CFWFile cfw_stdout_ = { .stream = { .obj = { .cls = &class, @@ -193,11 +193,11 @@ .ref_cnt = INT_MAX }, .ops = &stream_ops }, .fd = 1, - .eof = false + .at_end = false }; static CFWFile cfw_stderr_ = { .stream = { .obj = { .cls = &class, @@ -204,10 +204,10 @@ .ref_cnt = INT_MAX }, .ops = &stream_ops }, .fd = 2, - .eof = false + .at_end = false }; CFWFile *cfw_stdin = &cfw_stdin_; CFWFile *cfw_stdout = &cfw_stdout_; CFWFile *cfw_stderr = &cfw_stderr_; Index: src/stream.c ================================================================== --- src/stream.c +++ src/stream.c @@ -139,11 +139,11 @@ if ((buf = malloc(BUFFER_SIZE)) == NULL) return NULL; for (;;) { - if (stream->ops->eof(stream)) { + if (stream->ops->at_end(stream)) { free(buf); if (stream->cache == NULL) return NULL; @@ -272,21 +272,21 @@ free(tmp); return true; } bool -cfw_stream_eof(void *ptr) +cfw_stream_at_end(void *ptr) { CFWStream *stream = ptr; if (stream == NULL || stream->ops == NULL) return true; if (stream->cache != NULL) return false; - return stream->ops->eof(stream); + return stream->ops->at_end(stream); } void cfw_stream_close(void *ptr) { Index: src/stream.h ================================================================== --- src/stream.h +++ src/stream.h @@ -34,11 +34,11 @@ #include "string.h" struct cfw_stream_ops { ssize_t (*read)(void*, void*, size_t); bool (*write)(void*, const void*, size_t); - bool (*eof)(void*); + bool (*at_end)(void*); void (*close)(void*); }; typedef struct CFWStream { CFWObject obj; @@ -51,8 +51,8 @@ extern ssize_t cfw_stream_read(void*, void*, size_t); extern CFWString* cfw_stream_read_line(void*); extern bool cfw_stream_write(void*, const void*, size_t); extern bool cfw_stream_write_string(void*, const char*); extern bool cfw_stream_write_line(void*, const char*); -extern bool cfw_stream_eof(void*); +extern bool cfw_stream_at_end(void*); extern void cfw_stream_close(void*); #endif Index: src/tcpsocket.c ================================================================== --- src/tcpsocket.c +++ src/tcpsocket.c @@ -40,21 +40,21 @@ #include "tcpsocket.h" struct CFWTCPSocket { CFWStream stream; int fd; - bool eof; + bool at_end; }; static ssize_t sock_read(void *ptr, void *buf, size_t len) { CFWTCPSocket *sock = ptr; ssize_t ret; if ((ret = recv(sock->fd, buf, len, 0)) == 0) - sock->eof = true; + sock->at_end = true; return ret; } static bool @@ -68,15 +68,15 @@ return true; } static bool -sock_eof(void *ptr) +sock_at_end(void *ptr) { CFWTCPSocket *sock = ptr; - return sock->eof; + return sock->at_end; } static void sock_close(void *ptr) { @@ -87,11 +87,11 @@ } static struct cfw_stream_ops stream_ops = { .read = sock_read, .write = sock_write, - .eof = sock_eof, + .at_end = sock_at_end, .close = sock_close }; static bool ctor(void *ptr, va_list args) @@ -100,11 +100,11 @@ cfw_stream->ctor(ptr, args); sock->fd = -1; sock->stream.ops = &stream_ops; - sock->eof = false; + sock->at_end = false; return true; } static void