On Friday 01 February 2008 15:34:35 [EMAIL PROTECTED] wrote:

> Author: petdance
> Date: Fri Feb  1 15:34:35 2008
> New Revision: 25412
>
> Modified:
>    trunk/src/ops/var.ops
>
> Log:
> consting
>
> Modified: trunk/src/ops/var.ops

> --- trunk/src/ops/var.ops     (original)
> +++ trunk/src/ops/var.ops     Fri Feb  1 15:34:35 2008
> @@ -62,12 +63,15 @@
>  =cut
>
>  op find_lex(out PMC, in STR) {
> -    parrot_context_t * const ctx = CONTEXT(interp->ctx);
> -    STRING * const lex_name = $2;
> -    PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
> -    PMC *result = NULL;
> -
> -    if (!PMC_IS_NULL(lex_pad))
> +    parrot_context_t * const ctx      = CONTEXT(interp->ctx);
> +    STRING           * const lex_name = $2;
> +    PMC              * const lex_pad  = Parrot_find_pad(interp, lex_name,
> ctx); +
> +    PMC *result;
> +
> +    if (PMC_IS_NULL(lex_pad))
> +        result = NULL;
> +    else
>          result = VTABLE_get_pmc_keyed_str(interp, lex_pad, lex_name);
>      if (!result) {
>          real_exception(interp, NULL, LEX_NOT_FOUND,


Any reason not to write:

        PMC *result = PMC_IS_NULL(lex_pad) ? NULL : VTABLE...;

This assignment seems like a simple case, and you get a nice const opportunity 
for free.

-- c 

Reply via email to