lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250502113821.889-2-jiri@resnulli.us>
Date: Fri,  2 May 2025 13:38:17 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
	edumazet@...gle.com,
	kuba@...nel.org,
	pabeni@...hat.com,
	saeedm@...dia.com,
	horms@...nel.org,
	donald.hunter@...il.com
Subject: [PATCH net-next 1/5] tools: ynl-gen: extend block_start/end by noind arg

From: Jiri Pirko <jiri@...dia.com>

In order to allow block with no indentation, like switch-case, extend
block_start/end by "noind" arg allowing caller to instruct writer to
do no indentation.

Signed-off-by: Jiri Pirko <jiri@...dia.com>
---
 tools/net/ynl/pyynl/ynl_gen_c.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 9613a6135003..b4889974f645 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -1345,16 +1345,18 @@ class CodeWriter:
     def nl(self):
         self._nl = True
 
-    def block_start(self, line=''):
+    def block_start(self, line='', noind=False):
         if line:
             line = line + ' '
         self.p(line + '{')
-        self._ind += 1
+        if not noind:
+            self._ind += 1
 
-    def block_end(self, line=''):
+    def block_end(self, line='', noind=False):
         if line and line[0] not in {';', ','}:
             line = ' ' + line
-        self._ind -= 1
+        if not noind:
+            self._ind -= 1
         self._nl = False
         if not line:
             # Delay printing closing bracket in case "else" comes next
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ