mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
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.
This commit is contained in:
parent
c2cc02ea98
commit
39d91e9f88
@ -466,7 +466,11 @@ virBufferEscape(virBufferPtr buf, const char *toescape,
|
|||||||
cur = str;
|
cur = str;
|
||||||
out = escaped;
|
out = escaped;
|
||||||
while (*cur != 0) {
|
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++ = '\\';
|
||||||
*out++ = *cur;
|
*out++ = *cur;
|
||||||
cur++;
|
cur++;
|
||||||
|
Loading…
Reference in New Issue
Block a user