Author: petdance
Date: Wed Jun 6 23:00:39 2007
New Revision: 18854
Modified:
trunk/src/pmc/object.pmc
Log:
internal parm consting
Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc (original)
+++ trunk/src/pmc/object.pmc Wed Jun 6 23:00:39 2007
@@ -24,7 +24,7 @@
/* This finds the index of an attribute in an object's attribute store and
* returns it. Returns -1 if the attribute does not exist. */
static INTVAL get_attrib_index(Parrot_Interp interp, PMC *self, STRING *name) {
- Parrot_Class *_class = PARROT_CLASS(self);
+ Parrot_Class * const _class = PARROT_CLASS(self);
/* If we can't find the attribute, we hand back -1. */
INTVAL index = -1;
@@ -37,12 +37,11 @@
else {
/* No hit. We need to walk up the list of parents to try and find the
* attribute. */
- int num_classes = VTABLE_elements(interp, _class->all_parents);
+ const int num_classes = VTABLE_elements(interp, _class->all_parents);
int i;
for (i = 0; i < num_classes; i++) {
/* Get the class and its attribute metadata hash. */
- PMC *cur_class = VTABLE_get_pmc_keyed_int(interp,
_class->all_parents, i);
- Parrot_Class *class_info = PARROT_CLASS(cur_class);
+ PMC * const cur_class = VTABLE_get_pmc_keyed_int(interp,
_class->all_parents, i);
/* Build a string representing the fully qualified attribute name.
*/
STRING *fq_name = VTABLE_get_string(interp, cur_class);
@@ -118,7 +117,7 @@
*/
void mark() {
- Parrot_Object *obj = PARROT_OBJECT(SELF);
+ Parrot_Object * const obj = PARROT_OBJECT(SELF);
if (obj->_class)
pobject_lives(interp, (PObj*)obj->_class);
if (obj->attrib_store)
@@ -136,10 +135,10 @@
*/
PMC* get_attr_str(STRING *name) {
- Parrot_Object *obj = PARROT_OBJECT(SELF);
+ Parrot_Object * const obj = PARROT_OBJECT(SELF);
/* Look up the index. */
- INTVAL index = get_attrib_index(interp, obj->_class, name);
+ const INTVAL index = get_attrib_index(interp, obj->_class, name);
/* If lookup failed, exception. */
if (index == -1) {
@@ -162,10 +161,10 @@
*/
void set_attr_str(STRING* name, PMC* value) {
- Parrot_Object *obj = PARROT_OBJECT(SELF);
+ Parrot_Object * const obj = PARROT_OBJECT(SELF);
/* Look up the index. */
- INTVAL index = get_attrib_index(interp, obj->_class, name);
+ const INTVAL index = get_attrib_index(interp, obj->_class, name);
/* If lookup failed, exception. */
if (index == -1) {
@@ -187,8 +186,8 @@
*/
PMC* find_method(STRING *name)
{
- Parrot_Object *obj = PARROT_OBJECT(SELF);
- Parrot_Class *_class = PARROT_CLASS(obj->_class);
+ Parrot_Object * const obj = PARROT_OBJECT(SELF);
+ Parrot_Class * const _class = PARROT_CLASS(obj->_class);
PMC *method = PMCNULL;
/* Walk and search. One day, we'll use the cache first. */
@@ -196,8 +195,8 @@
int i;
for (i = 0; i < num_classes; i++) {
/* Get the class and see if it has the method. */
- PMC *cur_class = VTABLE_get_pmc_keyed_int(interp,
_class->all_parents, i);
- Parrot_Class *class_info = PARROT_CLASS(cur_class);
+ PMC * const cur_class = VTABLE_get_pmc_keyed_int(interp,
_class->all_parents, i);
+ const Parrot_Class * const class_info = PARROT_CLASS(cur_class);
if (VTABLE_exists_keyed_str(interp, class_info->methods, name)) {
/* Found it! */
method = VTABLE_get_pmc_keyed_str(interp, class_info->methods,
name);
@@ -220,7 +219,7 @@
*/
PMC* get_class()
{
- Parrot_Object *obj = PARROT_OBJECT(SELF);
+ const Parrot_Object * const obj = PARROT_OBJECT(SELF);
return obj->_class;
}
@@ -237,7 +236,7 @@
INTVAL can(STRING *method_name)
{
/* Just use find_method and see it if finds anything. */
- PMC *method = VTABLE_find_method(interp, SELF, method_name);
+ const PMC * const method = VTABLE_find_method(interp, SELF,
method_name);
return !PMC_IS_NULL(method);
}