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.
Patch (almost) for ticket #1215. The .pod file are for another commit.
Fix for the issues addressed in ticket #1215. Refactored duplicate co…
…de in the 'fetch' and 'vivify' opcodes.
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.
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.
discussion moved to trac; closing this request