sed-devel
[Top][All Lists]
Advanced

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

Re: stop octet storm in --debug (UTF-8)


From: Eric Blake
Subject: Re: stop octet storm in --debug (UTF-8)
Date: Sat, 29 Jun 2019 08:33:01 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

On 6/29/19 2:46 AM, Assaf Gordon wrote:

> +++ b/sed/debug.c
> @@ -66,7 +66,7 @@ debug_print_char (char c)
>        break;
>  
>      default:
> -      printf ("o%03o", (unsigned int) c);
> +      printf ("x%02x", (unsigned int) c & 0xff);

Hmm, this line is longer than necessary.  Equivalent effects can be
obtained by:

printf ("x%02x", c & 0xff);
printf ("x%02x", (unsigned char) c);

with my preference being on the former for avoiding a (now-unneeded) cast.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]