Browse files

consting pointers and localizing temp vars

  • Loading branch information...
1 parent fb59b7d commit f1c9ca5c456ae67172e21de34a4794da030afe46 @petdance petdance committed Feb 28, 2011
Showing with 9 additions and 11 deletions.
  1. +3 −3 src/pmc/namespace.pmc
  2. +2 −2 src/pmc/nativepccmethod.pmc
  3. +3 −5 src/pmc/nci.pmc
  4. +1 −1 src/pmc/object.pmc
View
6 src/pmc/namespace.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2005-2010, Parrot Foundation.
+Copyright (C) 2005-2011, Parrot Foundation.
=head1 NAME
@@ -465,7 +465,7 @@ really a public API.
if (val_is_NS) {
/* TODO - this hack needs to go */
- Parrot_NameSpace_attributes *nsinfo = PARROT_NAMESPACE(value);
+ Parrot_NameSpace_attributes * const nsinfo = PARROT_NAMESPACE(value);
nsinfo->parent = SELF; /* set parent */
nsinfo->name = key; /* and name */
@@ -1142,7 +1142,7 @@ Return the parent NameSpace or PMCNULL, if none.
*/
METHOD get_parent() {
- PMC *parent = PARROT_NAMESPACE(SELF)->parent ? PARROT_NAMESPACE(SELF)->parent : PMCNULL;
+ PMC * const parent = PARROT_NAMESPACE(SELF)->parent ? PARROT_NAMESPACE(SELF)->parent : PMCNULL;
RETURN(PMC *parent);
}
View
4 src/pmc/nativepccmethod.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2010, Parrot Foundation.
+Copyright (C) 2010-2011, Parrot Foundation.
=head1 NAME
@@ -164,7 +164,7 @@ Create a clone of this PMC.
*/
VTABLE PMC *clone() {
- PMC *ret = Parrot_pmc_new(INTERP, SELF->vtable->base_type);
+ PMC * const ret = Parrot_pmc_new(INTERP, SELF->vtable->base_type);
Parrot_NativePCCMethod_attributes *self_attrs = PARROT_NATIVEPCCMETHOD(SELF);
Parrot_NativePCCMethod_attributes *ret_attrs = PARROT_NATIVEPCCMETHOD(ret);
View
8 src/pmc/nci.pmc
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2010, Parrot Foundation.
+Copyright (C) 2001-2011, Parrot Foundation.
=head1 NAME
@@ -187,10 +187,9 @@ Creates and returns a clone of the NCI.
VTABLE PMC *clone() {
Parrot_NCI_attributes * const nci_info_self = PARROT_NCI(SELF);
- Parrot_NCI_attributes *nci_info_ret;
PMC * const ret = Parrot_pmc_new(INTERP, SELF->vtable->base_type);
- nci_info_ret = PARROT_NCI(ret);
+ Parrot_NCI_attributes * const nci_info_ret = PARROT_NCI(ret);
/* FIXME if data is malloced (JIT/i386!) then we need
* the length of data here, to memcpy it
@@ -317,13 +316,12 @@ Return the arity of the NCI (the number of arguments).
*/
METHOD arity() {
Parrot_NCI_attributes * const nci_info = PARROT_NCI(SELF);
- INTVAL arity = 0;
if (nci_info) {
if (!nci_info->func)
build_func(INTERP, SELF, nci_info);
if (nci_info->func) {
- arity = nci_info->arity;
+ const INTVAL arity = nci_info->arity;
RETURN(INTVAL arity);
}
}
View
2 src/pmc/object.pmc
@@ -777,7 +777,7 @@ Invokes the object (if this vtable function is overridden).
meth_name);
if (!PMC_IS_NULL(meth)) {
/* Experimental code. See api.yaml */
- PMC *call_sig =
+ PMC * const call_sig =
Parrot_pcc_get_signature(INTERP, CURRENT_CONTEXT(INTERP));
if ((VTABLE_elements(INTERP, call_sig) == 0

0 comments on commit f1c9ca5

Please sign in to comment.