[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m2mseyxg3l.fsf@gmail.com>
Date: Fri, 07 Feb 2025 09:24:14 +0000
From: Donald Hunter <donald.hunter@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>, Eric
Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Simon
Horman <horms@...nel.org>, Johannes Berg <johannes@...solutions.net>,
linux-wireless@...r.kernel.org, donald.hunter@...hat.com
Subject: Re: [PATCH net-next v3 06/10] tools/net/ynl: sanitise enums with
leading digits in ynl-gen-c
Jakub Kicinski <kuba@...nel.org> writes:
> 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():
Agreed. I'll use the simpler method.
> but either way:
>
> Acked-by: Jakub Kicinski <kuba@...nel.org>
TY.
Powered by blists - more mailing lists