[svn:parrot] r49248 - trunk/src

NotFound at svn.parrot.org NotFound at svn.parrot.org
Wed Sep 22 18:52:29 UTC 2010


Author: NotFound
Date: Wed Sep 22 18:52:29 2010
New Revision: 49248
URL: https://trac.parrot.org/parrot/changeset/49248

Log:
avoid an if/else with identical branches and some cleaning in the function Parrot_cx_find_handler_local

Modified:
   trunk/src/scheduler.c

Modified: trunk/src/scheduler.c
==============================================================================
--- trunk/src/scheduler.c	Wed Sep 22 17:40:33 2010	(r49247)
+++ trunk/src/scheduler.c	Wed Sep 22 18:52:29 2010	(r49248)
@@ -859,9 +859,9 @@
     static PMC * keep_context = NULL;
 
     PMC            *context;
-    PMC            *iter        = PMCNULL;
-    STRING * const  handled_str = CONST_STRING(interp, "handled");
-    STRING * const  iter_str    = CONST_STRING(interp, "handler_iter");
+    PMC            *iter             = PMCNULL;
+    STRING * const  handled_str      = CONST_STRING(interp, "handled");
+    STRING * const  handler_iter_str = CONST_STRING(interp, "handler_iter");
 
     if (already_doing) {
         Parrot_io_eprintf(interp,
@@ -886,7 +886,7 @@
          * tasks don't (though they could). */
         if (task->vtable->base_type == enum_class_Exception
         && VTABLE_get_integer_keyed_str(interp, task, handled_str) == -1) {
-            iter    = VTABLE_get_attr_str(interp, task, iter_str);
+            iter    = VTABLE_get_attr_str(interp, task, handler_iter_str);
             context = (PMC *)VTABLE_get_pointer(interp, task);
         }
         else {
@@ -904,17 +904,13 @@
 
             if (!PMC_IS_NULL(handler)) {
                 INTVAL valid_handler = 0;
-                if (handler->vtable->base_type == enum_class_Object)
-                    Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
-                        "P->I", task, &valid_handler);
-                else
-                    Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
+                Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
                         "P->I", task, &valid_handler);
 
                 if (valid_handler) {
                     if (task->vtable->base_type == enum_class_Exception) {
                         /* Store iterator and context for a later rethrow. */
-                        VTABLE_set_attr_str(interp, task, CONST_STRING(interp, "handler_iter"), iter);
+                        VTABLE_set_attr_str(interp, task, handler_iter_str, iter);
                         VTABLE_set_pointer(interp, task, context);
                     }
                     --already_doing;


More information about the parrot-commits mailing list