Re: [PATCH 1/1] termbits: Convert octal defines to hex

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

 



Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx> writes:
> Many archs have termbits.h as octal numbers. It makes hard for humans
> to parse the magnitude of large numbers correctly and to compare with
> hex ones of the same define.
>
> Convert octal values to hex.
>
> First step is an automated conversion with:
>
> for i in $(git ls-files | grep 'termbits\.h'); do
> 	awk --non-decimal-data '/^#define\s+[A-Z][A-Z0-9]*\s+0[0-9]/ {
> 		l=int(((length($3) - 1) * 3 + 3) / 4);
> 		repl = sprintf("0x%0" l "x", $3);
> 		print gensub(/[^[:blank:]]+/, repl, 3);
> 		next} {print}' $i > $i~;
> 	mv $i~ $i;
> done
>
> On top of that, some manual processing on alignment and number of zeros.
> In addition, small tweaks to formatting of a few comments on the same 
> lines.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@xxxxxxxxxxxxxxx>
> ---
>
> I prefer this to go in though Greg's tty tree.
>
>  arch/alpha/include/uapi/asm/termbits.h   | 202 ++++++++++-----------
>  arch/mips/include/uapi/asm/termbits.h    | 222 +++++++++++------------
>  arch/parisc/include/uapi/asm/termbits.h  | 220 +++++++++++-----------
>  arch/powerpc/include/uapi/asm/termbits.h | 202 ++++++++++-----------

I ran some horrible awk/sed/python mess over the before and after and
they seem to be numerically identical, so LGTM.

Acked-by: Michael Ellerman <mpe@xxxxxxxxxxxxxx> (powerpc)

cheers




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux