[svn:parrot] r48253 - in trunk/src: io pmc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Mon Aug 2 13:07:50 UTC 2010


Author: NotFound
Date: Mon Aug  2 13:07:50 2010
New Revision: 48253
URL: https://trac.parrot.org/parrot/changeset/48253

Log:
avoid special case for StringHandle in Parrot_io_close and Parrot_io_is_closed

Modified:
   trunk/src/io/api.c
   trunk/src/pmc/stringhandle.pmc

Modified: trunk/src/io/api.c
==============================================================================
--- trunk/src/io/api.c	Mon Aug  2 12:53:22 2010	(r48252)
+++ trunk/src/io/api.c	Mon Aug  2 13:07:50 2010	(r48253)
@@ -218,9 +218,6 @@
         result = Parrot_io_close_filehandle(interp, pmc);
         SETATTR_FileHandle_flags(interp, pmc, 0);
     }
-    else if (pmc->vtable->base_type == enum_class_StringHandle) {
-        SETATTR_StringHandle_read_offset(interp, pmc, 0);
-    }
     else
         Parrot_pcc_invoke_method_from_c_args(interp, pmc, CONST_STRING(interp, "close"), "->I", &result);
 
@@ -271,11 +268,6 @@
         return 1;
     if (pmc->vtable->base_type == enum_class_FileHandle)
         result = Parrot_io_is_closed_filehandle(interp, pmc);
-    else if (pmc->vtable->base_type == enum_class_StringHandle) {
-        STRING *stringhandle;
-        GETATTR_StringHandle_stringhandle(interp, pmc, stringhandle);
-        result = STRING_IS_NULL(stringhandle);
-    }
     else
         Parrot_pcc_invoke_method_from_c_args(interp, pmc, CONST_STRING(interp, "is_closed"), "->I", &result);
 

Modified: trunk/src/pmc/stringhandle.pmc
==============================================================================
--- trunk/src/pmc/stringhandle.pmc	Mon Aug  2 12:53:22 2010	(r48252)
+++ trunk/src/pmc/stringhandle.pmc	Mon Aug  2 13:07:50 2010	(r48253)
@@ -255,7 +255,10 @@
 */
 
     METHOD is_closed() {
-        const INTVAL status = Parrot_io_is_closed(INTERP, SELF);
+        STRING *stringhandle;
+        INTVAL status;
+        GET_ATTR_stringhandle(INTERP, SELF, stringhandle);
+        status = STRING_IS_NULL(stringhandle);
         RETURN(INTVAL status);
     }
 


More information about the parrot-commits mailing list