Patch with fixups for review comments in comment 7, if anyone wants to try this out in the next few days. > I don't really approve of the duplication of code but I see how hard it is > to parameterize it. There are some gratuitous differences, eg this one > operates on sizeof(wasm::Frame) several places while the other abstracts > that as nFrameBytes; with things like that fixed, the two functions look > more similar. Is it possible to factor head and tail parts and call them > from the two functions, and does that help? I fixed up the nFrameBytes vs sizeof(wasm::Frame) thing, and another one similar. I also resequenced the heads of the two functions so as to make them as similar as possible. That is definitely an improvment. I also looked at factoring out the heads and tails, but the amount of code it would remove would be minimal, and, given the parameter-passing that would be needed to deal with differences in the tail, I reckon it wouldn't help overall readability. So I didn't proceed further.
Bug 1517924 Comment 9 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Patch with fixups for review comments in comment 7, if anyone wants to try this out in the next few days. > I don't really approve of the duplication of code but I see how hard it is > to parameterize it. There are some gratuitous differences, eg this one > operates on sizeof(wasm::Frame) several places while the other abstracts > that as nFrameBytes; with things like that fixed, the two functions look > more similar. Is it possible to factor head and tail parts and call them > from the two functions, and does that help? I fixed up the nFrameBytes vs sizeof(wasm::Frame) thing, and another one similar. I also resequenced the heads of the two functions so as to make them as similar as possible. That is definitely an improvement. I also looked at factoring out the heads and tails, but the amount of code it would remove would be minimal, and, given the parameter-passing that would be needed to deal with differences in the tail, I reckon it wouldn't help overall readability. So I didn't proceed further.