Fix for Ticket #1215 #129

Closed
wants to merge 2 commits into from

2 participants

@soh-cah-toa

This is the refactored code for ticket #1215. I took the duplicate code in the 'fetch' and 'vivify' opcodes and moved it into separate functions to reduce redundancy.

I realize I probably should have just submitted a patch through Trac but I had already pushed the changes when I needed some help earlier today.

@cotto

Thanks for contributing. The common code between the ops can be factored into a single function, but it's not a general-purpose function we should expose as part of the API. Please make the following changes:

  • Don't change unrelated POD. This looks unintentional but still needs to be fixed. The codingstd_tests makefile target catches this.

  • Break the common code into a single static function in the .ops file. You can surround it with BEGIN_OPS_PREAMBLE and END_OPS_PREAMBLE and it'll be inserted into the generated C code. I'd suggest the name "parrot_pmc_new_from_type".

  • Use return values instead of ARGMOD arguments. The PMC null checks should stay in the ops.

@soh-cah-toa

Alright, will do. Someone on #parrot (I forget who) said I should put it in src/pmc.c for now; that's why it's there.

@soh-cah-toa soh-cah-toa reopened this Apr 11, 2011
@cotto

discussion moved to trac; closing this request

@cotto cotto closed this Apr 12, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment