Skip to content

Commit

Permalink
tools: ynl-gen: clean up stray new lines at the end of reply-less req…
Browse files Browse the repository at this point in the history
…uests

Do not print empty lines before closing brackets.

Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Jakub Kicinski committed Jun 6, 2023
1 parent ae91f7e commit a99bfdf
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tools/net/ynl/ynl-gen-c.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,9 +944,10 @@ def __init__(self, nlib, out_file):
def _is_cond(cls, line):
return line.startswith('if') or line.startswith('while') or line.startswith('for')

def p(self, line, add_ind=0):
def p(self, line, add_ind=0, eat_nl=False):
if self._nl:
self._out.write('\n')
if not eat_nl:
self._out.write('\n')
self._nl = False
ind = self._ind
if line[-1] == ':':
Expand All @@ -971,7 +972,7 @@ def block_end(self, line=''):
if line and line[0] not in {';', ','}:
line = ' ' + line
self._ind -= 1
self.p('}' + line)
self.p('}' + line, eat_nl=True)

def write_doc_line(self, doc, indent=True):
words = doc.split()
Expand Down

0 comments on commit a99bfdf

Please sign in to comment.