There are still a few style issues with your patch. You have inconsistent spacing after ifs ("if (" vs "if("), missing spaces after commas, and a few more "}else{"s. You also create a few blocks for no reason other than to get around the C declarations on top of block rule. Please organize these in tune with the surrounding code. Only create a "useless" block (ie a block without a control flow statement) if there is an #ifdef around it with other implementations. Also please don't do things like "if (x) { do {...} while(x); }".
More importantly you seem to be missing the tests for this.
(sorry for top posting; mobile gmail doesn't seem to have the ability to bottom post)
Mike.