Re: [PATCH] XML: Escape double-hyphens in XML comment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/21/2014 02:01 AM, Philipp Hahn wrote:
> To quote <http://www.w3.org/TR/REC-xml/#sec-comments>:
>> For compatibility, the string "--" (double-hyphen) must not occur within comments.
> 

>  
> +/*
> + * Break sequence of hyphens by inserting (arbitrarily chosen) backslashes.
> + * <http://www.w3.org/TR/REC-xml/#sec-comments>:
> + * > For compatibility, the string "--" (double-hyphen) must not occur within
> + * > comments.
> + */
> +static int virXMLEmitEscapedComment(int fd,
> +                                    const char *str)
> +{
> +    size_t len;
> +
> +    if (!strstr(str, "--")) {
> +        len = strlen(str);
> +        if (safewrite(fd, str, len) != len)
> +            return -1;
> +        return 0;
> +    }
> +
> +    for (;*str;str++) {

Style: spaces after ';'.

This would also be a perfect candidate for Dan's virStringReplace patch,
rather than open-coding your own replacement loop.

That, and Jan already pointed out better patches to be backported :)

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]