[svn:parrot] r39668 - in branches/io_cleanups: include/parrot src/io src/pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Fri Jun 19 00:56:40 UTC 2009


Author: whiteknight
Date: Fri Jun 19 00:56:39 2009
New Revision: 39668
URL: https://trac.parrot.org/parrot/changeset/39668

Log:
[io_cleanups] remove unused FileHandle ATTR file_size.

Modified:
   branches/io_cleanups/include/parrot/io.h
   branches/io_cleanups/src/io/filehandle.c
   branches/io_cleanups/src/io/unix.c
   branches/io_cleanups/src/pmc/filehandle.pmc

Modified: branches/io_cleanups/include/parrot/io.h
==============================================================================
--- branches/io_cleanups/include/parrot/io.h	Fri Jun 19 00:38:26 2009	(r39667)
+++ branches/io_cleanups/include/parrot/io.h	Fri Jun 19 00:56:39 2009	(r39668)
@@ -229,7 +229,6 @@
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
 PARROT_CANNOT_RETURN_NULL
 PMC * Parrot_io_open(PARROT_INTERP,
     ARGIN_NULLOK(PMC *pmc),
@@ -609,10 +608,6 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
-PIOOFF_T Parrot_io_get_file_size(SHIM_INTERP, ARGIN(PMC *filehandle))
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
 INTVAL Parrot_io_get_flags(SHIM_INTERP, ARGIN(PMC *filehandle))
         __attribute__nonnull__(2);
 
@@ -653,12 +648,6 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
-void Parrot_io_set_file_size(SHIM_INTERP,
-    ARGIN(PMC *filehandle),
-    PIOOFF_T file_size)
-        __attribute__nonnull__(2);
-
-PARROT_EXPORT
 void Parrot_io_set_flags(SHIM_INTERP, ARGIN(PMC *filehandle), INTVAL flags)
         __attribute__nonnull__(2);
 
@@ -727,8 +716,6 @@
        PARROT_ASSERT_ARG(filehandle)
 #define ASSERT_ARGS_Parrot_io_get_file_position __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(filehandle)
-#define ASSERT_ARGS_Parrot_io_get_file_size __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(filehandle)
 #define ASSERT_ARGS_Parrot_io_get_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(filehandle)
 #define ASSERT_ARGS_Parrot_io_get_last_file_position \
@@ -748,8 +735,6 @@
        PARROT_ASSERT_ARG(interp)
 #define ASSERT_ARGS_Parrot_io_set_file_position __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(filehandle)
-#define ASSERT_ARGS_Parrot_io_set_file_size __attribute__unused__ int _ASSERT_ARGS_CHECK = \
-       PARROT_ASSERT_ARG(filehandle)
 #define ASSERT_ARGS_Parrot_io_set_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = \
        PARROT_ASSERT_ARG(filehandle)
 #define ASSERT_ARGS_Parrot_io_set_os_handle __attribute__unused__ int _ASSERT_ARGS_CHECK = \

Modified: branches/io_cleanups/src/io/filehandle.c
==============================================================================
--- branches/io_cleanups/src/io/filehandle.c	Fri Jun 19 00:38:26 2009	(r39667)
+++ branches/io_cleanups/src/io/filehandle.c	Fri Jun 19 00:56:39 2009	(r39668)
@@ -237,57 +237,6 @@
 
 /*
 
-=item C<void Parrot_io_set_file_size(PARROT_INTERP, PMC *filehandle, PIOOFF_T
-file_size)>
-
-Set the C<file_size> attribute of the FileHandle object, which stores the
-current file size.
-
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-Parrot_io_set_file_size(SHIM_INTERP, ARGIN(PMC *filehandle), PIOOFF_T file_size)
-{
-    ASSERT_ARGS(Parrot_io_set_file_size)
-    PARROT_FILEHANDLE(filehandle)->file_size = file_size;
-}
-
-
-/*
-
-=item C<PIOOFF_T Parrot_io_get_file_size(PARROT_INTERP, PMC *filehandle)>
-
-Get the C<file_size> attribute of the FileHandle object, which stores the
-current file size.
-
-
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PIOOFF_T
-Parrot_io_get_file_size(SHIM_INTERP, ARGIN(PMC *filehandle))
-{
-    ASSERT_ARGS(Parrot_io_get_file_size)
-    return PARROT_FILEHANDLE(filehandle)->file_size;
-}
-
-/*
-
 =item C<void Parrot_io_set_buffer_start(PARROT_INTERP, PMC *filehandle, unsigned
 char *new_start)>
 

Modified: branches/io_cleanups/src/io/unix.c
==============================================================================
--- branches/io_cleanups/src/io/unix.c	Fri Jun 19 00:38:26 2009	(r39667)
+++ branches/io_cleanups/src/io/unix.c	Fri Jun 19 00:56:39 2009	(r39668)
@@ -600,18 +600,24 @@
     if (pos >= 0) {
         switch (whence) {
             case SEEK_SET:
+            /* This doesn't do anything */
+            /*
                 if (offset > Parrot_io_get_file_size(interp, filehandle)) {
                     Parrot_io_set_file_size(interp, filehandle, offset);
                 }
+            */
                 break;
             case SEEK_CUR:
                 {
+                    /* This doesn't do anything */
+                    /*
                     const PIOOFF_T avail = offset
                             + Parrot_io_get_buffer_next(interp, filehandle)
                             - Parrot_io_get_buffer_start(interp, filehandle);
                     if (avail > Parrot_io_get_file_size(interp, filehandle)) {
                         Parrot_io_set_file_size(interp, filehandle, avail);
                     }
+                    */
                 }
                 break;
             case SEEK_END:

Modified: branches/io_cleanups/src/pmc/filehandle.pmc
==============================================================================
--- branches/io_cleanups/src/pmc/filehandle.pmc	Fri Jun 19 00:38:26 2009	(r39667)
+++ branches/io_cleanups/src/pmc/filehandle.pmc	Fri Jun 19 00:56:39 2009	(r39668)
@@ -36,8 +36,7 @@
     ATTR STRING *filename;            /* The opened path and filename */
     ATTR STRING *mode;                /* The mode string used in open */
     ATTR STRING *encoding;            /* The encoding for read/write  */
-    ATTR INTVAL process_id;           /* Child process on pipes       */
-    ATTR PIOOFF_T file_size;          /* Current file size            */
+    ATTR INTVAL process_id;           /* The child pid                */
     ATTR PIOOFF_T file_pos;           /* Current real file pointer    */
     ATTR PIOOFF_T last_pos;           /* Last file position           */
     ATTR size_t buffer_size;          /* Buffer size                  */
@@ -47,12 +46,6 @@
     ATTR unsigned char *buffer_next;  /* Current read/write pointer   */
 
 /*
- * Using INTVAL for process_id is a temporary solution.
- * We may need to define a custom type to store it in a platform
- * dependant way.
- */
-
-/*
 
 =item C<void init()>
 
@@ -71,8 +64,6 @@
         data_struct->filename      = NULL;
         data_struct->mode          = NULL;
         data_struct->encoding      = NULL;
-        data_struct->process_id    = 0;
-        data_struct->file_size     = 0;
         data_struct->file_pos      = piooffsetzero;
         data_struct->last_pos      = piooffsetzero;
         data_struct->buffer_size   = 0;


More information about the parrot-commits mailing list