Search Linux Wireless

Re: [PATCH net-next v3 06/10] tools/net/ynl: sanitise enums with leading digits in ynl-gen-c

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

 



On Thu,  6 Feb 2025 09:26:54 +0000 Donald Hunter wrote:
>  class Type(SpecAttr):
> +    starts_with_digit = re.compile(r"^\d")
> +
>      def __init__(self, family, attr_set, attr, value):
>          super().__init__(family, attr_set, attr, value)
>  
> @@ -74,6 +76,8 @@ class Type(SpecAttr):
>          self.c_name = c_lower(self.name)
>          if self.c_name in _C_KW:
>              self.c_name += '_'
> +        if self.starts_with_digit.match(self.c_name):
> +            self.c_name = '_' + self.c_name

bit heavyweight with the regex? I think this would do:

	if self.c_name[0].isdigit():

but either way:

Acked-by: Jakub Kicinski <kuba@xxxxxxxxxx>




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux