Permalink
Browse files

Purge set_eof from IO subsystem.

Being at EOF is something the underlying system handle keeps track of, and not
something we should be able to affect from userspace.
  • Loading branch information...
1 parent 243bad2 commit 7fac98165f6764f99a740b760204cf36264d62d6 @gerdr committed Mar 12, 2013
Showing with 0 additions and 112 deletions.
  1. +0 −2 include/parrot/io.h
  2. +0 −2 src/io/api.c
  3. +0 −26 src/io/filehandle.c
  4. +0 −25 src/io/pipe.c
  5. +0 −25 src/io/socket.c
  6. +0 −25 src/io/stringhandle.c
  7. +0 −7 src/io/utilities.c
View
@@ -135,7 +135,6 @@ typedef INTVAL (*io_vtable_read_b) (PARROT_INTERP, PMC *handle, ARGOU
typedef INTVAL (*io_vtable_write_b) (PARROT_INTERP, PMC *handle, ARGIN(char * buffer), size_t byte_length);
typedef INTVAL (*io_vtable_flush) (PARROT_INTERP, PMC *handle);
typedef INTVAL (*io_vtable_is_eof) (PARROT_INTERP, PMC *handle);
-typedef void (*io_vtable_set_eof) (PARROT_INTERP, PMC *handle, INTVAL is_set);
typedef PIOOFF_T (*io_vtable_tell) (PARROT_INTERP, PMC *handle);
typedef PIOOFF_T (*io_vtable_seek) (PARROT_INTERP, PMC *handle, PIOOFF_T offset, INTVAL whence);
typedef void (*io_vtable_adv_position) (PARROT_INTERP, PMC *handle, size_t len);
@@ -158,7 +157,6 @@ typedef struct _io_vtable {
io_vtable_write_b write_b; /* Write bytes to the handle */
io_vtable_flush flush; /* Flush the handle */
io_vtable_is_eof is_eof; /* Determine if at end-of-file */
- io_vtable_set_eof set_eof; /* Set or clear the passed-EOF flag */
io_vtable_open open; /* Open the handle */
io_vtable_is_open is_open; /* Determine if the handle is open */
io_vtable_close close; /* Close the handle */
View
@@ -867,8 +867,6 @@ Parrot_io_read_byte_buffer_pmc(PARROT_INTERP, ARGMOD(PMC *handle),
account for whatever we read. */
if (bytes_read != byte_length)
VTABLE_set_integer_native(interp, buffer, bytes_read);
- if (bytes_read == 0)
- vtable->set_eof(interp, handle, 1);
vtable->adv_position(interp, handle, bytes_read);
return buffer;
}
View
@@ -108,13 +108,6 @@ static PIOOFF_T io_filehandle_seek(PARROT_INTERP,
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);
-static void io_filehandle_set_eof(PARROT_INTERP,
- ARGMOD(PMC *handle),
- INTVAL is_set)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*handle);
-
static void io_filehandle_set_flags(PARROT_INTERP,
ARGIN(PMC *handle),
INTVAL flags)
@@ -185,9 +178,6 @@ static INTVAL io_filehandle_write_b(PARROT_INTERP,
#define ASSERT_ARGS_io_filehandle_seek __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
-#define ASSERT_ARGS_io_filehandle_set_eof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_filehandle_set_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
@@ -235,7 +225,6 @@ io_filehandle_setup_vtable(PARROT_INTERP, ARGMOD_NULLOK(IO_VTABLE *vtable), INTV
vtable->write_b = io_filehandle_write_b;
vtable->flush = io_filehandle_flush;
vtable->is_eof = io_filehandle_is_eof;
- vtable->set_eof = io_filehandle_set_eof;
vtable->tell = io_filehandle_tell;
vtable->seek = io_filehandle_seek;
vtable->adv_position = io_filehandle_adv_position;
@@ -317,11 +306,6 @@ io_filehandle_flush(PARROT_INTERP, ARGMOD(PMC *handle))
Determine if this handle as at end-of-file.
-=item C<static void io_filehandle_set_eof(PARROT_INTERP, PMC *handle, INTVAL
-is_set)>
-
-Set or clear the EOF flag.
-
=cut
*/
@@ -337,16 +321,6 @@ io_filehandle_is_eof(PARROT_INTERP, ARGMOD(PMC *handle))
return 0;
}
-static void
-io_filehandle_set_eof(PARROT_INTERP, ARGMOD(PMC *handle), INTVAL is_set)
-{
- ASSERT_ARGS(io_filehandle_set_eof)
- if (is_set)
- PARROT_FILEHANDLE(handle)->flags |= PIO_F_EOF;
- else
- PARROT_FILEHANDLE(handle)->flags &= ~PIO_F_EOF;
-}
-
/*
=item C<static PIOOFF_T io_filehandle_tell(PARROT_INTERP, PMC *handle)>
View
@@ -102,13 +102,6 @@ static PIOOFF_T io_pipe_seek(PARROT_INTERP,
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);
-static void io_pipe_set_eof(PARROT_INTERP,
- ARGMOD(PMC *handle),
- INTVAL is_set)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*handle);
-
static void io_pipe_set_flags(PARROT_INTERP,
ARGIN(PMC *handle),
INTVAL flags)
@@ -179,9 +172,6 @@ static INTVAL io_pipe_write_b(PARROT_INTERP,
#define ASSERT_ARGS_io_pipe_seek __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
-#define ASSERT_ARGS_io_pipe_set_eof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_set_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
@@ -226,7 +216,6 @@ io_pipe_setup_vtable(PARROT_INTERP, ARGMOD_NULLOK(IO_VTABLE *vtable), INTVAL idx
vtable->write_b = io_pipe_write_b;
vtable->flush = io_pipe_flush;
vtable->is_eof = io_pipe_is_eof;
- vtable->set_eof = io_pipe_set_eof;
vtable->tell = io_pipe_tell;
vtable->seek = io_pipe_seek;
vtable->adv_position = io_pipe_adv_position;
@@ -312,10 +301,6 @@ io_pipe_flush(PARROT_INTERP, ARGMOD(PMC *handle))
Determine if the pipe thinks it's at the end of input.
-=item C<static void io_pipe_set_eof(PARROT_INTERP, PMC *handle, INTVAL is_set)>
-
-Do nothing.
-
=cut
*/
@@ -331,16 +316,6 @@ io_pipe_is_eof(PARROT_INTERP, ARGMOD(PMC *handle))
return 0;
}
-static void
-io_pipe_set_eof(PARROT_INTERP, ARGMOD(PMC *handle), INTVAL is_set)
-{
- ASSERT_ARGS(io_pipe_set_eof)
- if (is_set)
- PARROT_FILEHANDLE(handle)->flags |= PIO_F_EOF;
- else
- PARROT_FILEHANDLE(handle)->flags &= ~PIO_F_EOF;
-}
-
/*
=item C<static PIOOFF_T io_pipe_tell(PARROT_INTERP, PMC *handle)>
View
@@ -106,13 +106,6 @@ static PIOOFF_T io_socket_seek(PARROT_INTERP,
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);
-static void io_socket_set_eof(PARROT_INTERP,
- ARGMOD(PMC *handle),
- INTVAL is_eof)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*handle);
-
static void io_socket_set_flags(PARROT_INTERP,
ARGIN(PMC *handle),
INTVAL flags)
@@ -183,9 +176,6 @@ static INTVAL io_socket_write_b(PARROT_INTERP,
#define ASSERT_ARGS_io_socket_seek __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
-#define ASSERT_ARGS_io_socket_set_eof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_set_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
@@ -230,7 +220,6 @@ io_socket_setup_vtable(PARROT_INTERP, ARGMOD_NULLOK(IO_VTABLE *vtable), INTVAL i
vtable->write_b = io_socket_write_b;
vtable->flush = io_socket_flush;
vtable->is_eof = io_socket_is_eof;
- vtable->set_eof = io_socket_set_eof;
vtable->tell = io_socket_tell;
vtable->seek = io_socket_seek;
vtable->adv_position = io_socket_adv_position;
@@ -310,11 +299,6 @@ io_socket_flush(PARROT_INTERP, ARGMOD(PMC *handle))
Sockets are not "passed-the-end" so long as the connection is open. Return 0.
-=item C<static void io_socket_set_eof(PARROT_INTERP, PMC *handle, INTVAL
-is_eof)>
-
-Do nothing.
-
=cut
*/
@@ -328,15 +312,6 @@ io_socket_is_eof(PARROT_INTERP, ARGMOD(PMC *handle))
return 0;
}
-static void
-io_socket_set_eof(PARROT_INTERP, ARGMOD(PMC *handle), INTVAL is_eof)
-{
- ASSERT_ARGS(io_socket_set_eof)
- UNUSED(interp);
- UNUSED(handle);
- UNUSED(is_eof);
-}
-
/*
=item C<static PIOOFF_T io_socket_tell(PARROT_INTERP, PMC *handle)>
View
@@ -106,13 +106,6 @@ static PIOOFF_T io_stringhandle_seek(PARROT_INTERP,
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);
-static void io_stringhandle_set_eof(PARROT_INTERP,
- ARGMOD(PMC *handle),
- INTVAL is_set)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*handle);
-
static void io_stringhandle_set_flags(PARROT_INTERP,
ARGIN(PMC *handle),
INTVAL flags)
@@ -183,9 +176,6 @@ static INTVAL io_stringhandle_write_b(PARROT_INTERP,
#define ASSERT_ARGS_io_stringhandle_seek __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
-#define ASSERT_ARGS_io_stringhandle_set_eof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_stringhandle_set_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
@@ -238,7 +228,6 @@ io_stringhandle_setup_vtable(PARROT_INTERP, ARGMOD_NULLOK(IO_VTABLE *vtable), IN
vtable->write_b = io_stringhandle_write_b;
vtable->flush = io_stringhandle_flush;
vtable->is_eof = io_stringhandle_is_eof;
- vtable->set_eof = io_stringhandle_set_eof;
vtable->tell = io_stringhandle_tell;
vtable->seek = io_stringhandle_seek;
vtable->adv_position = io_stringhandle_adv_position;
@@ -339,11 +328,6 @@ io_stringhandle_flush(PARROT_INTERP, ARGMOD(PMC *handle))
The StringHandle is at eof if the current read cursor is passed the end of the
string contents.
-=item C<static void io_stringhandle_set_eof(PARROT_INTERP, PMC *handle, INTVAL
-is_set)>
-
-Do nothing.
-
=cut
*/
@@ -359,15 +343,6 @@ io_stringhandle_is_eof(PARROT_INTERP, ARGMOD(PMC *handle))
return (UINTVAL)read_offs >= stringhandle->bufused;
}
-static void
-io_stringhandle_set_eof(PARROT_INTERP, ARGMOD(PMC *handle), INTVAL is_set)
-{
- ASSERT_ARGS(io_stringhandle_set_eof)
- UNUSED(interp);
- UNUSED(handle);
- UNUSED(is_set);
-}
-
/*
=item C<static PIOOFF_T io_stringhandle_tell(PARROT_INTERP, PMC *handle)>
View
@@ -337,9 +337,6 @@ io_read_encoded_string(PARROT_INTERP, ARGMOD(PMC *handle),
break;
}
- if (total_bytes_read == 0)
- vtable->set_eof(interp, handle, 1);
-
return s;
}
@@ -473,10 +470,6 @@ io_readline_encoded_string(PARROT_INTERP, ARGMOD(PMC *handle),
at_eof = BUFFER_FREE_END_SPACE(buffer) > 0;
}
- /* XXX: Hasn't this been already handled at a lower-level? */
- if (total_bytes_read == 0)
- vtable->set_eof(interp, handle, 1);
-
return s;
}

0 comments on commit 7fac981

Please sign in to comment.