[svn:parrot] r39667 - branches/io_cleanups/src/io

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Fri Jun 19 00:38:27 UTC 2009


Author: whiteknight
Date: Fri Jun 19 00:38:26 2009
New Revision: 39667
URL: https://trac.parrot.org/parrot/changeset/39667

Log:
[io_cleanups] remove some unnecessary debugging assertions, and allow Parrot_io_open to create an HLLmapped PMC instead of just a vanilla FileHandle (not really supported currently)

Modified:
   branches/io_cleanups/src/io/api.c

Modified: branches/io_cleanups/src/io/api.c
==============================================================================
--- branches/io_cleanups/src/io/api.c	Fri Jun 19 00:37:38 2009	(r39666)
+++ branches/io_cleanups/src/io/api.c	Fri Jun 19 00:38:26 2009	(r39667)
@@ -96,9 +96,6 @@
     return new_io;
 }
 
-
-
-
 /*
 
 =item C<PMC * Parrot_io_open(PARROT_INTERP, PMC *pmc, STRING *path, STRING
@@ -122,24 +119,18 @@
     PMC *new_filehandle, *filehandle;
     INTVAL flags;
     if (PMC_IS_NULL(pmc)) {
-        /* TODO: We should look up the HLL mapped type, instead of always
-           using FileHandle here */
-        new_filehandle = pmc_new(interp, enum_class_FileHandle);
-        PARROT_ASSERT(new_filehandle->vtable->base_type == enum_class_FileHandle);
+        new_filehandle = pmc_new(interp,
+            Parrot_get_ctx_HLL_type(interp, enum_class_FileHandle));
     }
     else
         new_filehandle = pmc;
 
     flags = Parrot_io_parse_open_flags(interp, mode);
     if (new_filehandle->vtable->base_type == enum_class_FileHandle) {
-        /* TODO: StringHandle may have a null path, but a filehandle really
-           shouldn't allow that. */
-        PARROT_ASSERT(new_filehandle->vtable->base_type == enum_class_FileHandle);
         filehandle = PIO_OPEN(interp, new_filehandle, path, flags);
         if (PMC_IS_NULL(filehandle))
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR,
                 "Unable to open filehandle from path '%S'", path);
-        PARROT_ASSERT(filehandle->vtable->base_type == enum_class_FileHandle);
         SETATTR_FileHandle_flags(interp, new_filehandle, flags);
         SETATTR_FileHandle_filename(interp, new_filehandle, path);
         SETATTR_FileHandle_mode(interp, new_filehandle, mode);
@@ -223,9 +214,8 @@
         result = Parrot_io_close_filehandle(interp, pmc);
         SETATTR_FileHandle_flags(interp, pmc, 0);
     }
-    else if (pmc->vtable->base_type == enum_class_StringHandle) {
+    else if (pmc->vtable->base_type == enum_class_StringHandle)
         SETATTR_StringHandle_read_offset(interp, pmc, 0);
-    }
     else
         Parrot_PCCINVOKE(interp, pmc, CONST_STRING(interp, "close"), "->I", &result);
 


More information about the parrot-commits mailing list