Skip to content

bring the two loops in act_txtobj into alignment

Sven M. Hallberg requested to merge issue44 into master

The function act_txtobj() performs two passes over the sequence of text operators. The first pass tracks position and length of the string. Then an array is allocated of the indicated length and a second pass fills it with the actual characters.

The two passes must be close carbon copies of each other or a mismatch between the predetermined length and the actual number of characters produced might occur and cause the assertion "txtlen == idx" to fail.

This code structure is obviously bad, a text book example of why code duplication should be avoided. Nevertheless, before rewriting it entirely, this patch at least corrects an immediate bug.

Fixes #44 (closed).

Merge request reports

Loading