This loop-control condition with a post-decrement operator would lead to
an underflow of collapsed_newlines. This in turn would cause a subsequent
execution of the loop to labor inordinately trying to return the loop-control
variable to a value of 0 again.
Fix this by dis-intertwining the test and the decrement.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65112
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
{
ralloc_strncat(&clean, shader,
newline - shader + 1);
- while (collapsed_newlines--)
+ while (collapsed_newlines) {
ralloc_strcat(&clean, "\n");
+ collapsed_newlines--;
+ }
shader = newline + 1;
search_start = shader;
}