Commit a99bfdf6 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

tools: ynl-gen: clean up stray new lines at the end of reply-less requests



Do not print empty lines before closing brackets.

Reviewed-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ae91f7e4
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -944,8 +944,9 @@ class CodeWriter:
    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:
            if not eat_nl:
                self._out.write('\n')
            self._nl = False
        ind = self._ind
@@ -971,7 +972,7 @@ class CodeWriter:
        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()