Respect TOSTRAND() lifetime

In a different context, I questioned my understanding of C object
lifetimes and learned that I had given the wrong explanation for why
TOSTRAND() was used wrongly in
0c96fc65:

TOSTRAND() creates a compound literal whose lifetime is the enclosing
block.

Thus, the error was unrelated to temporary lifetime, but rather that
the compound literal was assigned in the if-block, but used outside
it.

Ref: https://stackoverflow.com/questions/71225472/more-questions-on-the-c11-temporary-lifetime-rule-and-undefined-behaviour/71226049#71226049
parent c7104e3e
......@@ -474,10 +474,9 @@ vsl_line(VRT_CTX, char *str)
return;
str = strtok_r(NULL, "\r\n", &save);
s = TOSTRAND(str);
if (str == NULL)
s = vrt_null_strands;
else
s = TOSTRAND(str);
vmod_vsl(ctx, id, tag, side, s);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment