提交 39d91e9f 编写于 作者: S Stefan Berger

Fix strchr call triggering gcc 4.3 & 4.4 bug

Replacing the strchr call with two variables through a strstr call.
Calling strchr with two variables triggers a gcc 4.3/4.4
bug when used in combination with -Wlogical-op and at least -O1.
上级 c2cc02ea
......@@ -466,7 +466,11 @@ virBufferEscape(virBufferPtr buf, const char *toescape,
cur = str;
out = escaped;
while (*cur != 0) {
if (strchr(toescape, *cur))
/* strchr work-around for gcc 4.3 & 4.4 bug with -Wlogical-op
* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36513
*/
char needle[2] = { *cur, 0 };
if (strstr(toescape, needle))
*out++ = '\\';
*out++ = *cur;
cur++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册