[svn:parrot] r36405 - trunk/languages/lua/src/pmc

fperrad at svn.parrot.org fperrad at svn.parrot.org
Fri Feb 6 17:55:05 UTC 2009


Author: fperrad
Date: Fri Feb  6 17:55:03 2009
New Revision: 36405
URL: https://trac.parrot.org/parrot/changeset/36405

Log:
[Lua] more consting

Modified:
   trunk/languages/lua/src/pmc/lua.pmc
   trunk/languages/lua/src/pmc/luaany.pmc
   trunk/languages/lua/src/pmc/luaboolean.pmc
   trunk/languages/lua/src/pmc/luabytecode.pmc
   trunk/languages/lua/src/pmc/luafunction.pmc
   trunk/languages/lua/src/pmc/luanil.pmc
   trunk/languages/lua/src/pmc/luanumber.pmc
   trunk/languages/lua/src/pmc/luastring.pmc
   trunk/languages/lua/src/pmc/luatable.pmc
   trunk/languages/lua/src/pmc/luathread.pmc
   trunk/languages/lua/src/pmc/luauserdata.pmc

Modified: trunk/languages/lua/src/pmc/lua.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/lua.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/lua.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -90,7 +90,7 @@
 */
     METHOD PMC* clock() {
         const FLOATVAL f = clock() / (FLOATVAL)CLOCKS_PER_SEC;
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, f);
         RETURN(PMC *retval);
     }

Modified: trunk/languages/lua/src/pmc/luaany.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luaany.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luaany.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -159,8 +159,8 @@
 
         if (meth) {
             if (dynpmc_LuaFunction == PMC_type(meth)) {
-                PMC *retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
-                                                       SELF, key);
+                PMC * const retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
+                                                              SELF, key);
                 if (retval)
                     return retval;
 
@@ -285,13 +285,13 @@
 
             /* fix me */
 #if 1
-            retval = Parrot_runops_fromc_args(INTERP, meth, "PP", SELF);
-            if (!retval)
-                retval = pmc_new(INTERP, dynpmc_LuaNil);
+        retval = Parrot_runops_fromc_args(INTERP, meth, "PP", SELF);
+        if (!retval)
+            retval = pmc_new(INTERP, dynpmc_LuaNil);
 #else
-            next = VTABLE_invoke(INTERP, meth, next);
+        next = VTABLE_invoke(INTERP, meth, next);
 #endif
-            return (opcode_t *)next;
+        return (opcode_t *)next;
     }
 
 /*
@@ -580,7 +580,7 @@
 
 */
     METHOD PMC* get_metatable() {
-        PMC *nil = pmc_new(INTERP, dynpmc_LuaNil);
+        PMC * const nil = pmc_new(INTERP, dynpmc_LuaNil);
         RETURN(PMC *nil);
     }
 
@@ -618,7 +618,7 @@
 
 */
     METHOD PMC* tonumber() {
-        PMC *nil = pmc_new(INTERP, dynpmc_LuaNil);
+        PMC * const nil = pmc_new(INTERP, dynpmc_LuaNil);
         RETURN(PMC *nil);
     }
 

Modified: trunk/languages/lua/src/pmc/luaboolean.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luaboolean.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luaboolean.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -240,8 +240,7 @@
 
 */
     MULTI INTVAL is_equal(LuaBoolean value) {
-        return (VTABLE_get_integer(INTERP, SELF)
-            ==  VTABLE_get_integer(INTERP, value));
+        return (INTVAL)(VTABLE_get_integer(INTERP, SELF) == VTABLE_get_integer(INTERP, value));
     }
 
     MULTI INTVAL is_equal(DEFAULT value) {
@@ -262,14 +261,11 @@
 
 */
     METHOD PMC* rawequal(PMC *value) {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-
-        if (PMC_type(SELF) == PMC_type(value)
-         && VTABLE_get_integer(INTERP, SELF) == VTABLE_get_integer(INTERP, value))
-            VTABLE_set_integer_native(INTERP, retval, 1);
-        else
-            VTABLE_set_integer_native(INTERP, retval, 0);
-
+        const INTVAL b = (PMC_type(SELF) == PMC_type(value)
+            && VTABLE_get_integer(INTERP, SELF) == VTABLE_get_integer(INTERP, value))
+                         ? 1 : 0;
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        VTABLE_set_integer_native(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 

Modified: trunk/languages/lua/src/pmc/luabytecode.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luabytecode.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luabytecode.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -122,10 +122,10 @@
 
 static PMC * _new_lua(Interp *interp, const char *name)
 {
-    PMC * key = key_append(interp,
+    PMC * const key = key_append(interp,
           key_new_cstring(interp, "Lua"),
           key_new_cstring(interp, name));
-    PMC * class_object = Parrot_oo_get_class(interp, key);
+    PMC * const class_object = Parrot_oo_get_class(interp, key);
     if (class_object == PMCNULL)
         Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ILL_INHERIT,
               "Lua::%s not loaded", name);
@@ -136,7 +136,7 @@
 
 static PMC* _load_bool(Interp *interp)
 {
-    PMC* ret = pmc_new(interp, pmc_type(interp,
+    PMC* const ret = pmc_new(interp, pmc_type(interp,
           Parrot_str_new_constant(interp, "Boolean")));
     VTABLE_set_integer_native(interp, ret, _get_byte());
     return ret;
@@ -144,7 +144,7 @@
 
 static PMC* _load_byte(Interp *interp)
 {
-    PMC* ret = pmc_new(interp, pmc_type(interp,
+    PMC* const ret = pmc_new(interp, pmc_type(interp,
           Parrot_str_new_constant(interp, "Integer")));
     VTABLE_set_integer_native(interp, ret, _get_byte());
     return ret;
@@ -152,7 +152,7 @@
 
 static PMC* _load_integer(Interp *interp)
 {
-    PMC* ret = pmc_new(interp, pmc_type(interp,
+    PMC* const ret = pmc_new(interp, pmc_type(interp,
           Parrot_str_new_constant(interp, "Integer")));
     VTABLE_set_integer_native(interp, ret, _get_integer());
     return ret;
@@ -160,7 +160,7 @@
 
 static PMC* _load_string(Interp *interp)
 {
-    PMC* ret = pmc_new(interp, pmc_type(interp,
+    PMC* const ret = pmc_new(interp, pmc_type(interp,
           Parrot_str_new_constant(interp, "String")));
     VTABLE_set_string_native(interp, ret, _get_string(interp));
     return ret;
@@ -199,8 +199,8 @@
 static PMC* _load_instruction_list(Interp *interp)
 {
     int i;
-    int n = _get_integer();
-    PMC * ret = _new_lua(interp, "InstructionList");
+    const int n = _get_integer();
+    PMC * const ret = _new_lua(interp, "InstructionList");
     VTABLE_set_integer_native(interp, ret, n);
 
     for (i = 0; i < n; i++) {
@@ -213,13 +213,13 @@
 static PMC* _load_constant_list(Interp *interp)
 {
     int i;
-    int n = _get_integer();
-    PMC * ret = _new_lua(interp, "ConstantList");
+    const int n = _get_integer();
+    PMC * const ret = _new_lua(interp, "ConstantList");
     VTABLE_set_integer_native(interp, ret, n);
 
     for (i = 0; i < n; i++) {
         PMC* k;
-        int type = _get_byte();
+        const int type = _get_byte();
         switch (type) {
         case 0:
             k = _new_lua(interp, "Nil");
@@ -248,8 +248,8 @@
 static PMC* _load_prototype_list(Interp *interp)
 {
     int i;
-    int n = _get_integer();
-    PMC * ret = _new_lua(interp, "PrototypeList");
+    const int n = _get_integer();
+    PMC * const ret = _new_lua(interp, "PrototypeList");
     VTABLE_set_integer_native(interp, ret, n);
 
     for (i = 0; i < n; i++) {
@@ -262,8 +262,8 @@
 static PMC* _load_line_list(Interp *interp)
 {
     int i;
-    int n = _get_integer();
-    PMC * ret = _new_lua(interp, "LineList");
+    const int n = _get_integer();
+    PMC * const ret = _new_lua(interp, "LineList");
     VTABLE_set_integer_native(interp, ret, n);
 
     for (i = 0; i < n; i++) {
@@ -276,12 +276,12 @@
 static PMC* _load_local_list(Interp *interp)
 {
     int i;
-    int n = _get_integer();
-    PMC * ret = _new_lua(interp, "LocalList");
+    const int n = _get_integer();
+    PMC * const ret = _new_lua(interp, "LocalList");
     VTABLE_set_integer_native(interp, ret, n);
 
     for (i = 0; i < n; i++) {
-        PMC* local = _new_lua(interp, "Local");
+        PMC* const local = _new_lua(interp, "Local");
         VTABLE_set_string_native(interp, local, _get_string(interp));
         VTABLE_set_attr_str(interp, local,
             Parrot_str_new_constant(interp, "startpc"), _load_integer(interp));
@@ -296,12 +296,12 @@
 static PMC* _load_upvalue_list(Interp *interp)
 {
     int i;
-    int n = _get_integer();
-    PMC * ret = _new_lua(interp, "UpvalueList");
+    const int n = _get_integer();
+    PMC * const ret = _new_lua(interp, "UpvalueList");
     VTABLE_set_integer_native(interp, ret, n);
 
     for (i = 0; i < n; i++) {
-        PMC* upvalue = _new_lua(interp, "Upvalue");
+        PMC* const upvalue = _new_lua(interp, "Upvalue");
         VTABLE_set_string_native(interp, upvalue, _get_string(interp));
         VTABLE_set_pmc_keyed_int(interp, ret, i, upvalue);
     }
@@ -311,7 +311,7 @@
 
 static PMC* _load_function(Interp *interp)
 {
-    PMC * ret = _new_lua(interp, "Function");
+    PMC * const ret = _new_lua(interp, "Function");
 
     VTABLE_set_attr_str(interp, ret,
         Parrot_str_new_constant(interp, "source"), _load_string(interp));
@@ -379,7 +379,7 @@
 
 */
     METHOD PMC* undump(STRING* luabytecode) {
-        PMC * script = _new_lua(INTERP, "Bytecode");
+        PMC * const script = _new_lua(INTERP, "Bytecode");
 
         _init(INTERP, luabytecode);
         _load_header(INTERP, script);

Modified: trunk/languages/lua/src/pmc/luafunction.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luafunction.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luafunction.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -153,7 +153,7 @@
 */
     METHOD STRING *get_name() {
         const Parrot_sub * const sub = PMC_sub(SELF);
-        STRING *retval = Parrot_str_copy(INTERP, sub->name);
+        STRING * const retval = Parrot_str_copy(INTERP, sub->name);
         RETURN(STRING *retval);
     }
 
@@ -181,15 +181,12 @@
 
 */
     METHOD PMC* rawequal(PMC *value) {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-
-        if (PMC_type(SELF)             == PMC_type(value)
-        && (PMC_sub(SELF))->start_offs == (PMC_sub(value))->start_offs
-        && (PMC_sub(SELF))->seg        == (PMC_sub(value))->seg)
-            VTABLE_set_integer_native(INTERP, retval, 1);
-        else
-            VTABLE_set_integer_native(INTERP, retval, 0);
-
+        const INTVAL b = (PMC_type(SELF) == PMC_type(value)
+          && (PMC_sub(SELF))->start_offs == (PMC_sub(value))->start_offs
+                 && (PMC_sub(SELF))->seg == (PMC_sub(value))->seg)
+                         ? 1 : 0;
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        VTABLE_set_integer_native(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 

Modified: trunk/languages/lua/src/pmc/luanil.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luanil.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luanil.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -81,7 +81,7 @@
 
 */
     VTABLE PMC* clone() {
-        PMC *dest = pmc_new(INTERP, PMC_type(SELF));
+        PMC * const dest = pmc_new(INTERP, PMC_type(SELF));
         STRUCT_COPY(&PMC_union(dest), &PMC_union(SELF));
         return dest;
     }
@@ -160,12 +160,9 @@
 
 */
     METHOD PMC *rawequal(PMC *value) {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-        if (PMC_type(SELF) == PMC_type(value))
-            VTABLE_set_integer_native(INTERP, retval, 1);
-        else
-            VTABLE_set_integer_native(INTERP, retval, 0);
-
+        const INTVAL b = (PMC_type(SELF) == PMC_type(value)) ? 1 : 0;
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        VTABLE_set_integer_native(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 

Modified: trunk/languages/lua/src/pmc/luanumber.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luanumber.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luanumber.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -115,7 +115,7 @@
 */
     VTABLE PMC *clone() {
         FLOATVAL fv;
-        PMC *dest = pmc_new(INTERP, PMC_type(SELF));
+        PMC * const dest = pmc_new(INTERP, PMC_type(SELF));
         GET_ATTR_fv(INTERP, SELF, fv);
         SET_ATTR_fv(INTERP, dest, fv);
         return dest;
@@ -325,7 +325,7 @@
     }
 
     MULTI PMC *add(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -367,7 +367,7 @@
     }
 
     MULTI void i_add(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -411,7 +411,7 @@
     }
 
     MULTI PMC *subtract(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -454,7 +454,7 @@
     }
 
     MULTI void i_subtract(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -497,7 +497,7 @@
     }
 
     MULTI PMC *multiply(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -537,7 +537,7 @@
     }
 
     MULTI void i_multiply(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -580,7 +580,7 @@
     }
 
     MULTI PMC *divide(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -621,7 +621,7 @@
     }
 
     MULTI void i_divide(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -665,7 +665,7 @@
     }
 
     MULTI PMC *modulus(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                "->P", &n);
 
@@ -707,7 +707,7 @@
     }
 
     MULTI void i_modulus(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -750,7 +750,7 @@
     }
 
     MULTI PMC *pow(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -791,7 +791,7 @@
     }
 
     MULTI void i_pow(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, value, Parrot_str_new_constant(interp, "tonumber"),
                 "->P", &n);
 
@@ -858,7 +858,7 @@
 =cut
 
 */
-    MULTI PMC *concatenate(LuaNumber value,  PMC *dest) {
+    MULTI PMC *concatenate(LuaNumber value, PMC *dest) {
         STRING * const s = Parrot_str_concat(INTERP, SELF.get_string(),
             VTABLE_get_string(INTERP, value), 0);
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
@@ -866,7 +866,7 @@
         return dest;
     }
 
-    MULTI PMC *concatenate(LuaString value,  PMC *dest) {
+    MULTI PMC *concatenate(LuaString value, PMC *dest) {
         STRING * const s = Parrot_str_concat(INTERP, SELF.get_string(),
             VTABLE_get_string(INTERP, value), 0);
         dest = pmc_new(INTERP, dynpmc_LuaNumber);
@@ -874,7 +874,7 @@
         return dest;
     }
 
-    MULTI PMC *concatenate(DEFAULT value,  PMC *dest) {
+    MULTI PMC *concatenate(DEFAULT value, PMC *dest) {
         PMC * const meth = find_meth(INTERP, value, "__concat");
 
         if (meth) {
@@ -941,7 +941,7 @@
 */
     METHOD PMC* acosh() {
         const FLOATVAL n = acosh(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -955,7 +955,7 @@
 */
     METHOD PMC* asinh() {
         const FLOATVAL n = asinh(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -969,7 +969,7 @@
 */
     METHOD PMC* atanh() {
         const FLOATVAL n = atanh(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -983,7 +983,7 @@
 */
     METHOD PMC* cbrt() {
         const FLOATVAL n = cbrt(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -998,7 +998,7 @@
     METHOD PMC* copysign(PMC* y) {
         const FLOATVAL n = copysign(VTABLE_get_number(INTERP, SELF),
                                     VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1012,7 +1012,7 @@
 */
     METHOD PMC* erf() {
         const FLOATVAL n = erf(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1026,7 +1026,7 @@
 */
     METHOD PMC* erfc() {
         const FLOATVAL n = erfc(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1040,7 +1040,7 @@
 */
     METHOD PMC* exp2() {
         const FLOATVAL n = exp2(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1054,7 +1054,7 @@
 */
     METHOD PMC* expm1() {
         const FLOATVAL n = expm1(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1069,7 +1069,7 @@
     METHOD PMC* fdim(PMC* y) {
         const FLOATVAL n = fdim(VTABLE_get_number(INTERP, SELF),
                                 VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1085,7 +1085,7 @@
         const FLOATVAL n = fma(VTABLE_get_number(INTERP, SELF),
                                VTABLE_get_number(INTERP, y),
                                VTABLE_get_number(INTERP, z));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1100,7 +1100,7 @@
     METHOD PMC* fmax(PMC* y) {
         const FLOATVAL n = fmax(VTABLE_get_number(INTERP, SELF),
                                 VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1115,7 +1115,7 @@
     METHOD PMC* fmin(PMC* y) {
         const FLOATVAL n = fmin(VTABLE_get_number(INTERP, SELF),
                                 VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1128,7 +1128,7 @@
 
 */
     METHOD PMC* fpclassify() {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaString);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaString);
         const char *p;
         switch (fpclassify(VTABLE_get_number(INTERP, SELF))) {
         case FP_INFINITE:       p = "inf";              break;
@@ -1151,14 +1151,14 @@
 
 */
     METHOD PMC* frexp() {
-        PMC *y      = pmc_new(INTERP, dynpmc_LuaNumber);
-        PMC *expn   = pmc_new(INTERP, dynpmc_LuaNumber);
-        PMC *retval = pmc_new(INTERP, enum_class_Array);
-        int  e;
-
-        VTABLE_set_number_native(INTERP, y,
-                                 frexp(VTABLE_get_number(INTERP, SELF), &e));
-        VTABLE_set_integer_native(INTERP, expn, e);
+        int _e;
+        const FLOATVAL _y  = frexp(VTABLE_get_number(INTERP, SELF), &_e);
+        PMC * const y      = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const expn   = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, enum_class_Array);
+
+        VTABLE_set_number_native(INTERP, y, _y);
+        VTABLE_set_integer_native(INTERP, expn, _e);
         VTABLE_set_integer_native(INTERP, retval, 2);
         VTABLE_set_pmc_keyed_int(INTERP, retval, 0, y);
         VTABLE_set_pmc_keyed_int(INTERP, retval, 1, expn);
@@ -1176,7 +1176,7 @@
     METHOD PMC* hypot(PMC* y) {
         const FLOATVAL n = hypot(VTABLE_get_number(INTERP, SELF),
                                  VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1190,7 +1190,7 @@
 */
     METHOD PMC* ilogb() {
         const FLOATVAL n = ilogb(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1204,7 +1204,7 @@
 */
     METHOD PMC* isfinite() {
         const INTVAL b = isfinite(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
         VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
@@ -1218,7 +1218,7 @@
 */
     METHOD PMC* isinf() {
         const INTVAL b = isinf(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
         VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
@@ -1232,7 +1232,7 @@
 */
     METHOD PMC* isnan() {
         const INTVAL b = isnan(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
         VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
@@ -1246,7 +1246,7 @@
 */
     METHOD PMC* isnormal() {
         const INTVAL b = isnormal(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
         VTABLE_set_bool(INTERP, retval, b);
         RETURN(PMC *retval);
     }
@@ -1261,7 +1261,7 @@
     METHOD PMC* ldexp(PMC *expn) {
         const FLOATVAL n = ldexp(VTABLE_get_number(INTERP, SELF),
                                  VTABLE_get_integer(INTERP, expn));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1275,7 +1275,7 @@
 */
     METHOD PMC* lgamma() {
         const FLOATVAL n = lgamma(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1289,7 +1289,7 @@
 */
     METHOD PMC* log1p() {
         const FLOATVAL n = log1p(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1303,7 +1303,7 @@
 */
     METHOD PMC* log2() {
         const FLOATVAL n = log2(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1317,7 +1317,7 @@
 */
     METHOD PMC* logb() {
         const FLOATVAL n = logb(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1330,13 +1330,13 @@
 
 */
     METHOD PMC* modf() {
-        PMC     *y      = pmc_new(INTERP, dynpmc_LuaNumber);
-        PMC     *d      = pmc_new(INTERP, dynpmc_LuaNumber);
-        PMC     *retval = pmc_new(INTERP, enum_class_Array);
         FLOATVAL _d;
+        const FLOATVAL _y  = modf(VTABLE_get_number(INTERP, SELF), &_d);
+        PMC * const y      = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const d      = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, enum_class_Array);
 
-        VTABLE_set_number_native(INTERP, y,
-                                 modf(VTABLE_get_number(INTERP, SELF), &_d));
+        VTABLE_set_number_native(INTERP, y, _y);
         VTABLE_set_number_native(INTERP, d, _d);
         VTABLE_set_integer_native(INTERP, retval, 2);
         VTABLE_set_pmc_keyed_int(INTERP, retval, 0, d);
@@ -1354,7 +1354,7 @@
 */
     METHOD PMC* nearbyint() {
         const FLOATVAL n = nearbyint(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1369,7 +1369,7 @@
     METHOD PMC* nextafter(PMC* y) {
         const FLOATVAL n = nextafter(VTABLE_get_number(INTERP, SELF),
                                      VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1384,7 +1384,7 @@
     METHOD PMC* nexttoward(PMC* y) {
         const FLOATVAL n = nexttoward(VTABLE_get_number(INTERP, SELF),
                                       VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1397,14 +1397,11 @@
 
 */
     METHOD PMC *rawequal(PMC *value) {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-
-        if (PMC_type(SELF) == PMC_type(value)
-        &&  VTABLE_get_number(INTERP, SELF) == VTABLE_get_number(INTERP, value))
-            VTABLE_set_integer_native(INTERP, retval, 1);
-        else
-            VTABLE_set_integer_native(INTERP, retval, 0);
-
+        const INTVAL b = (PMC_type(SELF) == PMC_type(value)
+            && VTABLE_get_number(INTERP, SELF) == VTABLE_get_number(INTERP, value))
+                         ? 1 : 0;
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        VTABLE_set_integer_native(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 
@@ -1418,7 +1415,7 @@
     METHOD PMC* remainder(PMC* y) {
         const FLOATVAL n = remainder(VTABLE_get_number(INTERP, SELF),
                                      VTABLE_get_number(INTERP, y));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1432,7 +1429,7 @@
 */
     METHOD PMC* rint() {
         const FLOATVAL n = rint(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1446,7 +1443,7 @@
 */
     METHOD PMC* round() {
         const FLOATVAL n = round(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1461,7 +1458,7 @@
     METHOD PMC* scalbn(PMC* ex) {
         const FLOATVAL n = scalbn(VTABLE_get_number(INTERP, SELF),
                                   VTABLE_get_number(INTERP, ex));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1475,7 +1472,7 @@
 */
     METHOD PMC* signbit() {
         const FLOATVAL n = signbit(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1489,7 +1486,7 @@
 */
     METHOD PMC* tgamma() {
         const FLOATVAL n = tgamma(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1503,7 +1500,7 @@
 */
     METHOD PMC* trunc() {
         const FLOATVAL n = trunc(VTABLE_get_number(INTERP, SELF));
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, n);
         RETURN(PMC *retval);
     }
@@ -1516,7 +1513,7 @@
 
 */
     METHOD PMC *tonumber() {
-        PMC *clone = SELF.clone();
+        PMC * const clone = SELF.clone();
         RETURN(PMC *clone);
     }
 

Modified: trunk/languages/lua/src/pmc/luastring.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luastring.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luastring.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -188,7 +188,7 @@
 
 */
     VTABLE PMC* neg(PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -207,7 +207,7 @@
 
 */
     VTABLE void i_neg() {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -276,7 +276,7 @@
 
 */
     MULTI PMC* add(LuaNumber value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -288,7 +288,7 @@
     }
 
     MULTI PMC* add(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -322,7 +322,7 @@
 
 */
     MULTI void i_add(LuaNumber value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -335,7 +335,7 @@
     }
 
     MULTI void i_add(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -370,7 +370,7 @@
 
 */
     MULTI PMC* subtract(LuaNumber value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -382,7 +382,7 @@
     }
 
     MULTI PMC* subtract(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -416,7 +416,7 @@
 
 */
     MULTI void i_subtract(LuaNumber value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -429,7 +429,7 @@
     }
 
     MULTI void i_subtract(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -465,7 +465,7 @@
 
 */
     MULTI PMC* multiply(LuaNumber value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -477,7 +477,7 @@
     }
 
     MULTI PMC* multiply(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -511,7 +511,7 @@
 
 */
     MULTI void i_multiply(LuaNumber value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -524,7 +524,7 @@
     }
 
     MULTI void i_multiply(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -559,7 +559,7 @@
 
 */
     MULTI PMC* divide(LuaNumber value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -571,7 +571,7 @@
     }
 
     MULTI PMC* divide(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -606,7 +606,7 @@
 
 */
     MULTI void i_divide(LuaNumber value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -619,7 +619,7 @@
     }
 
     MULTI void i_divide(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -654,7 +654,7 @@
 
 */
     MULTI PMC* modulus(LuaNumber value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -666,7 +666,7 @@
     }
 
     MULTI PMC* modulus(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -701,7 +701,7 @@
 
 */
     MULTI void i_modulus(LuaNumber value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -714,7 +714,7 @@
     }
 
     MULTI void i_modulus(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -749,7 +749,7 @@
 
 */
     MULTI PMC* pow(LuaNumber value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -761,7 +761,7 @@
     }
 
     MULTI PMC* pow(LuaString value, PMC *dest) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -796,7 +796,7 @@
 
 */
     MULTI void i_pow(LuaNumber value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -809,7 +809,7 @@
     }
 
     MULTI void i_pow(LuaString value) {
-        PMC *n;
+        PMC * const n;
         Parrot_PCCINVOKE(interp, SELF, Parrot_str_new_constant(interp, "tonumber"),
             "->P", &n);
 
@@ -850,7 +850,7 @@
     MULTI INTVAL is_equal(LuaString value) {
         STRING * const s = SELF.get_string();
         STRING * const v = VTABLE_get_string(INTERP, value);
-        return (INTVAL)(0 == Parrot_str_not_equal(INTERP, s, v));
+        return Parrot_str_equal(INTERP, s, v);
     }
 
     MULTI INTVAL is_equal(DEFAULT value) {
@@ -990,7 +990,7 @@
 
 */
     METHOD PMC* len() {
-        PMC *retval         = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaNumber);
         VTABLE_set_number_native(INTERP, retval, SELF.elements());
         RETURN(PMC *retval);
     }

Modified: trunk/languages/lua/src/pmc/luatable.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luatable.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luatable.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -396,12 +396,12 @@
 */
     VTABLE void mark() {
         STRING *mode = NULL;
-        PMC    *meta = PMC_metadata(SELF);
+        PMC * const meta = PMC_metadata(SELF);
 
         if (meta) {
             PMC **m;
 #if 0
-            PMC *key = pmc_new(INTERP, dynpmc_LuaString);
+            PMC * const key = pmc_new(INTERP, dynpmc_LuaString);
             VTABLE_set_string_native(INTERP, key,
                     Parrot_str_new_constant(INTERP, "__mode"));
             m = lua_get(INTERP, PMC_hash(meta), key);
@@ -570,7 +570,7 @@
 
 */
     VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) {
-        PMC * pmc_key = pmc_new(INTERP, dynpmc_LuaString);
+        PMC * const pmc_key = pmc_new(INTERP, dynpmc_LuaString);
         VTABLE_set_string_native(INTERP, pmc_key, Parrot_str_copy(INTERP, key));
         value = VTABLE_clone(interp, value);
         *lua_set(INTERP, PMC_hash(SELF), pmc_key) = value;
@@ -607,8 +607,8 @@
     MULTI INTVAL is_equal(LuaTable value) {
         PMC * const meth = find_meth(INTERP, SELF, "__eq");
         if (meth) {
-            PMC *retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
-                                                   SELF, value);
+            PMC * const retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
+                                                          SELF, value);
 
             if (PMC_IS_NULL(retval))
                 return (INTVAL)0;
@@ -616,10 +616,7 @@
             return VTABLE_get_bool(INTERP, retval);
         }
 
-        if (SELF == value)
-            return (INTVAL)1;
-        else
-            return (INTVAL)0;
+        return (SELF == value) ? (INTVAL)1 : (INTVAL)0;
     }
 
     MULTI INTVAL is_equal(DEFAULT value) {
@@ -637,8 +634,8 @@
 #if 0
         PMC * const meth = find_meth(INTERP, SELF, "__cmp");
         if (meth) {
-            PMC *retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
-                                                   SELF, value);
+            PMC * const retval = Parrot_runops_fromc_args(INTERP, meth, "PPP",
+                                                          SELF, value);
 
             if (retval)
                 return (INTVAL)VTABLE_get_number(INTERP, retval);
@@ -720,8 +717,8 @@
 
 */
     METHOD PMC* len() {
-        PMC   **pvalue;
-        PMC   *key = pmc_new(INTERP, dynpmc_LuaNumber);
+        PMC **pvalue;
+        PMC * const key = pmc_new(INTERP, dynpmc_LuaNumber);
         INTVAL idx = 1;
 
         VTABLE_set_integer_native(INTERP, key, idx);
@@ -746,17 +743,17 @@
 
 */
     METHOD PMC* next(PMC* index) {
-        Node *n = lua_next(INTERP, PMC_hash(SELF), index);
+        Node * const n = lua_next(INTERP, PMC_hash(SELF), index);
 
         if (n) {
-            PMC *retval = pmc_new(INTERP, enum_class_Array);
+            PMC * const retval = pmc_new(INTERP, enum_class_Array);
             VTABLE_set_integer_native(INTERP, retval, 2);
             VTABLE_set_pmc_keyed_int(INTERP, retval, 0, n->key);
             VTABLE_set_pmc_keyed_int(INTERP, retval, 1, n->val);
             RETURN(PMC *retval);
         }
         else {
-            PMC *retval = pmc_new(INTERP, dynpmc_LuaNil);
+            PMC * const retval = pmc_new(INTERP, dynpmc_LuaNil);
             RETURN(PMC *retval);
         }
 
@@ -770,8 +767,9 @@
 
 */
     METHOD PMC* rawequal(PMC *value) {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-        VTABLE_set_integer_native(INTERP, retval, (SELF == value) ? 1 : 0);
+        const INTVAL b = (SELF == value) ? 1 : 0;
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        VTABLE_set_integer_native(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 

Modified: trunk/languages/lua/src/pmc/luathread.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luathread.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luathread.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -67,7 +67,7 @@
 
 */
     VTABLE void init_pmc(PMC *sub) {
-        PMC *classobj = Parrot_oo_get_class_str(INTERP,
+        PMC * const classobj = Parrot_oo_get_class_str(INTERP,
                           Parrot_str_new_constant(INTERP, "Parrot::Coroutine"));
         PMC *init_args;
 
@@ -170,14 +170,11 @@
 
 */
     MULTI INTVAL is_equal(LuaThread value) {
-        if (SELF == value)
-            return (INTVAL)1;
-        else
-            return (INTVAL)0;
+        return (SELF == value) ? (INTVAL)1 : (INTVAL)0;
     }
 
     MULTI INTVAL is_equal(DEFAULT value) {
-            return (INTVAL)0;
+        return (INTVAL)0;
     }
 
 /*
@@ -210,13 +207,10 @@
 
 */
     METHOD PMC* rawequal(PMC *value) {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-
-        if (PMC_type(SELF) == PMC_type(value) && SELF == value)
-            VTABLE_set_integer_native(INTERP, retval, 1);
-        else
-            VTABLE_set_integer_native(INTERP, retval, 0);
-
+        const INTVAL b = (PMC_type(SELF) == PMC_type(value) && SELF == value)
+                         ? 1 : 0;
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        VTABLE_set_integer_native(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 

Modified: trunk/languages/lua/src/pmc/luauserdata.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luauserdata.pmc	Fri Feb  6 16:52:48 2009	(r36404)
+++ trunk/languages/lua/src/pmc/luauserdata.pmc	Fri Feb  6 17:55:03 2009	(r36405)
@@ -215,14 +215,11 @@
             return VTABLE_get_bool(INTERP, retval);
         }
 
-        if (SELF == value)
-            return (INTVAL)1;
-        else
-            return (INTVAL)0;
+        return (SELF == value) ? (INTVAL)1 : (INTVAL)0;
     }
 
     MULTI INTVAL is_equal(DEFAULT value) {
-            return (INTVAL)0;
+        return (INTVAL)0;
     }
 
 /*
@@ -335,15 +332,12 @@
 
 */
     METHOD PMC* rawequal(PMC *value) {
-        PMC *retval = pmc_new(INTERP, dynpmc_LuaBoolean);
-
-        if (PMC_type(SELF) == PMC_type(value)
-        && u_val(SELF)     == u_val(value)
-        && u_env(SELF)     == u_env(value))
-            VTABLE_set_integer_native(INTERP, retval, 1);
-        else
-            VTABLE_set_integer_native(INTERP, retval, 0);
-
+        const INTVAL b = (PMC_type(SELF) == PMC_type(value)
+                          && u_val(SELF) == u_val(value)
+                          && u_env(SELF) == u_env(value))
+                         ? 1 : 0;
+        PMC * const retval = pmc_new(INTERP, dynpmc_LuaBoolean);
+        VTABLE_set_integer_native(INTERP, retval, b);
         RETURN(PMC *retval);
     }
 


More information about the parrot-commits mailing list