Permalink
Browse files

Don't use variables named 'pmc'

Parrot's SELF variables are named that.  The shadowing caused the wrong values
to be set in the wrong places, eventually causing a PMC to be treated as a
PerlInterpreter; segfault ensued.
  • Loading branch information...
1 parent 28e07ac commit 5fa07ce5e66bfd9846b8d5c7a450dbc87b90640d @sorear sorear committed Apr 25, 2010
Showing with 11 additions and 11 deletions.
  1. +6 −6 src/pmc/bkmarshal.c
  2. +5 −5 src/pmc/p5interpreter.pmc
View
@@ -126,16 +126,16 @@ PARROT_CANNOT_RETURN_NULL
PMC *
blizkost_wrap_sv(PARROT_INTERP, PMC *p5i, SV *sv) {
PerlInterpreter *my_perl;
- PMC *pmc = Parrot_pmc_new_noinit(interp, pmc_type(interp,
+ PMC *wrapper = Parrot_pmc_new_noinit(interp, pmc_type(interp,
string_from_literal(interp, "P5Scalar")));
- PObj_custom_mark_SET(pmc);
- PObj_custom_destroy_SET(pmc);
+ PObj_custom_mark_SET(wrapper);
+ PObj_custom_destroy_SET(wrapper);
GETATTR_P5Interpreter_my_perl(interp, p5i, my_perl);
- SETATTR_P5Scalar_p5i(interp, pmc, p5i);
- SETATTR_P5Scalar_sv(interp, pmc, SvREFCNT_inc(sv));
- return pmc;
+ SETATTR_P5Scalar_p5i(interp, wrapper, p5i);
+ SETATTR_P5Scalar_sv(interp, wrapper, SvREFCNT_inc(sv));
+ return wrapper;
}
/*
View
@@ -162,14 +162,14 @@ Acquire a namespace handle.
*/
METHOD PMC *get_namespace(STRING *name) {
- PMC *pmc = Parrot_pmc_new_noinit(interp, pmc_type(interp,
+ PMC *ns = Parrot_pmc_new_noinit(interp, pmc_type(interp,
string_from_literal(interp, "P5Namespace")));
/* Set up the underlying structure. */
- PObj_custom_mark_SET(pmc);
- SETATTR_P5Namespace_p5i(interp, pmc, SELF);
- SETATTR_P5Namespace_ns_name(interp, pmc, name);
+ PObj_custom_mark_SET(ns);
+ SETATTR_P5Namespace_p5i(interp, ns, SELF);
+ SETATTR_P5Namespace_ns_name(interp, ns, name);
- RETURN(PMC *pmc);
+ RETURN(PMC *ns);
}
}

0 comments on commit 5fa07ce

Please sign in to comment.