[svn:parrot] r46019 - trunk/src/pmc

petdance at svn.parrot.org petdance at svn.parrot.org
Mon Apr 26 05:04:26 UTC 2010


Author: petdance
Date: Mon Apr 26 05:04:25 2010
New Revision: 46019
URL: https://trac.parrot.org/parrot/changeset/46019

Log:
consting

Modified:
   trunk/src/pmc/exception.pmc

Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc	Mon Apr 26 05:00:36 2010	(r46018)
+++ trunk/src/pmc/exception.pmc	Mon Apr 26 05:04:25 2010	(r46019)
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 2001-2009, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
 $Id$
 
 =head1 NAME
@@ -113,7 +113,7 @@
         INTVAL severity_val;
         STRING *message_val;
 
-        INTVAL ishash = VTABLE_isa(interp, values, CONST_STRING(interp, 'Hash'));
+        const INTVAL ishash = VTABLE_isa(interp, values, CONST_STRING(interp, 'Hash'));
 
         if (ishash) {
             STRING * const severity = CONST_STRING(interp, "severity");
@@ -205,7 +205,7 @@
 */
 
     VTABLE INTVAL get_integer() {
-        Parrot_Exception_attributes * const exception = PARROT_EXCEPTION(SELF);
+        const Parrot_Exception_attributes * const exception = PARROT_EXCEPTION(SELF);
         return exception->id;
     }
 
@@ -221,7 +221,7 @@
 */
 
     VTABLE STRING *get_string_keyed(PMC *key) {
-        STRING *name = VTABLE_get_string(INTERP, key);
+        STRING * const name = VTABLE_get_string(INTERP, key);
         STRING *message;
 
         if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
@@ -247,7 +247,7 @@
 */
 
     VTABLE INTVAL get_integer_keyed(PMC *key) {
-        STRING *name   = VTABLE_get_string(INTERP, key);
+        STRING * const name = VTABLE_get_string(INTERP, key);
         INTVAL  result = 0;
 
         if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
@@ -316,7 +316,7 @@
 */
 
     VTABLE PMC *get_pmc_keyed(PMC *key) {
-        STRING *s = VTABLE_get_string(INTERP, key);
+        STRING * const s = VTABLE_get_string(INTERP, key);
         return SELF.get_attr_str(s);
     }
 
@@ -376,7 +376,7 @@
 */
 
     VTABLE void set_string_keyed(PMC *key, STRING *value) {
-        STRING *name = VTABLE_get_string(INTERP, key);
+        STRING * const name = VTABLE_get_string(INTERP, key);
 
         if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
             SELF.set_string_native(value);
@@ -399,7 +399,7 @@
 */
 
     VTABLE void set_integer_keyed(PMC *key, INTVAL value) {
-        STRING *name = VTABLE_get_string(INTERP, key);
+        STRING * const name = VTABLE_get_string(INTERP, key);
 
         if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
             SET_ATTR_type(interp, SELF, value);
@@ -461,7 +461,7 @@
 */
 
     VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
-        STRING *s = VTABLE_get_string(INTERP, key);
+        STRING * const s = VTABLE_get_string(INTERP, key);
         SELF.set_attr_str(s, value);
     }
 
@@ -492,7 +492,7 @@
 */
 
     VTABLE void *get_pointer() {
-        Parrot_Exception_attributes * const core_struct = PARROT_EXCEPTION(SELF);
+        const Parrot_Exception_attributes * const core_struct = PARROT_EXCEPTION(SELF);
         return core_struct->handler_ctx;
     }
 
@@ -604,23 +604,23 @@
     VTABLE void set_attr_str(STRING *name, PMC *value) {
 
         if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
-            INTVAL type = VTABLE_get_integer(interp, value);
+            const INTVAL type = VTABLE_get_integer(interp, value);
             SET_ATTR_type(interp, SELF, type);
         }
         else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "severity"))) {
-            INTVAL severity = VTABLE_get_integer(interp, value);
+            const INTVAL severity = VTABLE_get_integer(interp, value);
             SET_ATTR_severity(interp, SELF, severity);
         }
         else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "exit_code"))) {
-            INTVAL exit_code = VTABLE_get_integer(interp, value);
+            const INTVAL exit_code = VTABLE_get_integer(interp, value);
             SET_ATTR_exit_code(interp, SELF, exit_code);
         }
         else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "handled"))) {
-            INTVAL handled = VTABLE_get_integer(interp, value);
+            const INTVAL handled = VTABLE_get_integer(interp, value);
             SET_ATTR_handled(interp, SELF, handled);
         }
         else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
-            STRING *message = VTABLE_get_string(interp, value);
+            STRING * const message = VTABLE_get_string(interp, value);
             SELF.set_string_native(message);
         }
         else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "payload"))) {
@@ -639,7 +639,7 @@
             /* Ensure it's a ret cont, and extract the from_ctx.
              * XXX TT #596 - when we have Context PMCs, just take and set that. */
             if (!PMC_IS_NULL(value) && VTABLE_isa(interp, value, CONST_STRING(interp, "Continuation"))) {
-                PMC *ctx = PMC_cont(value)->from_ctx;
+                PMC * const ctx = PMC_cont(value)->from_ctx;
                 if (!PMC_IS_NULL(ctx))
                     SET_ATTR_thrower(interp, SELF, ctx);
             }
@@ -704,7 +704,7 @@
         /* Get resume continuation, to find location we failed at. */
         GET_ATTR_resume(interp, SELF, resume);
         if (!PMC_IS_NULL(resume)) {
-            Parrot_Continuation_attributes *cont = PARROT_CONTINUATION(resume);
+            const Parrot_Continuation_attributes * const cont = PARROT_CONTINUATION(resume);
             if (cont->seg != NULL && cont->seg->annotations != NULL)
                 result = PackFile_Annotations_lookup(interp, cont->seg->annotations,
                         cont->address - cont->seg->base.data, name);
@@ -737,20 +737,17 @@
     METHOD backtrace() {
         PMC *result = PMCNULL;
         PMC *resume;
-        Parrot_Continuation_attributes    *cont;
 
         /* Get starting context, then loop over them. */
         GET_ATTR_resume(interp, SELF, resume);
         if (!PMC_IS_NULL(resume)) {
-            /* We have a resume continuation, so we can get the address from
-             * that. */
-            cont    = PARROT_CONTINUATION(resume);
+            /* We have a resume continuation, so we can get the address from that. */
+            const Parrot_Continuation_attributes * const cont = PARROT_CONTINUATION(resume);
             Parrot_pcc_invoke_method_from_c_args(INTERP, cont->to_ctx, CONST_STRING(interp, "backtrace"), "P->P", resume, &result);
         }
         else {
             PMC *cur_ctx;
             /* No return continuation. Assuming we're being called  */
-            cont = NULL;
             GET_ATTR_thrower(interp, SELF, cur_ctx);
             Parrot_pcc_invoke_method_from_c_args(INTERP, CURRENT_CONTEXT(INTERP), CONST_STRING(interp, "backtrace"), "->P", &result);
         }


More information about the parrot-commits mailing list