From: Rico Tzschichholz Date: Mon, 19 Nov 2018 13:25:14 +0000 (+0100) Subject: ccode: Don't allow more than one consecutive empty lines in generated code X-Git-Tag: 0.43.1~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9d6a8bf4fa8bb1987f24340d7cd7020e24192b8;p=thirdparty%2Fvala.git ccode: Don't allow more than one consecutive empty lines in generated code --- diff --git a/ccode/valaccodewriter.vala b/ccode/valaccodewriter.vala index a71e16c89..21cc41720 100644 --- a/ccode/valaccodewriter.vala +++ b/ccode/valaccodewriter.vala @@ -61,6 +61,8 @@ public class Vala.CCodeWriter { /* at begin of line */ private bool _bol = true; + /* at begin after empty line */ + private bool _bael = false; public CCodeWriter (string filename, string? source_filename = null) { this.filename = filename; @@ -195,6 +197,13 @@ public class Vala.CCodeWriter { * Writes a newline. */ public void write_newline () { + if (!_bol) { + _bael = false; + } else if (!_bael) { + _bael = true; + } else { + return; + } stream.putc ('\n'); current_line_number++; _bol = true;