[U-Boot] [RFC PATCH] moveconfig: add a second pass for empty #if/#endif blocks

Andy Shevchenko andriy.shevchenko at linux.intel.com
Mon Jun 4 09:49:28 UTC 2018


On Mon, 2018-06-04 at 21:27 +1200, Chris Packham wrote:
> Moveconfig already attempts to remove empty #if/#endif blocks when
> there
> is a matching CONFIG_ being moved. Add a second pass which covers
> files
> without a match.

> +    pattern = r'^\s*#\s*if.*$\n^\s*#\s*endif.*$\n*'

Any reason not to use re.compile() ?

> +    with open(header_path) as f:
> +        data = f.read()
> +
> +    new_data = re.sub(pattern, '\n', data, flags=re.M)

-- 
Andy Shevchenko <andriy.shevchenko at linux.intel.com>
Intel Finland Oy


More information about the U-Boot mailing list