summaryrefslogtreecommitdiff
path: root/ccode
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-11-19 14:25:14 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2018-11-19 16:02:12 +0100
commitb9d6a8bf4fa8bb1987f24340d7cd7020e24192b8 (patch)
treeb0edc9a04886ac7b69f5061ab67374b68e7cc3cf /ccode
parent2ba06ae75d4751f2d6696a688a2192d23b8536b4 (diff)
downloadvala-b9d6a8bf4fa8bb1987f24340d7cd7020e24192b8.tar.gz
ccode: Don't allow more than one consecutive empty lines in generated code
Diffstat (limited to 'ccode')
-rw-r--r--ccode/valaccodewriter.vala9
1 files changed, 9 insertions, 0 deletions
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;