Skip to content

Commit

Permalink
consting pointers and localizing temp vars
Browse files Browse the repository at this point in the history
  • Loading branch information
petdance committed Feb 28, 2011
1 parent fb59b7d commit f1c9ca5
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/pmc/namespace.pmc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2005-2010, Parrot Foundation.
Copyright (C) 2005-2011, Parrot Foundation.

=head1 NAME

Expand Down Expand Up @@ -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 */

Expand Down Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/pmc/nativepccmethod.pmc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2010, Parrot Foundation.
Copyright (C) 2010-2011, Parrot Foundation.

=head1 NAME

Expand Down Expand Up @@ -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);

Expand Down
8 changes: 3 additions & 5 deletions src/pmc/nci.pmc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2010, Parrot Foundation.
Copyright (C) 2001-2011, Parrot Foundation.

=head1 NAME

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/pmc/object.pmc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f1c9ca5

Please sign in to comment.