From 96ea478287964f5b91c6161c76a7ff5d5146e84a Mon Sep 17 00:00:00 2001 From: Charlie Gordon Date: Thu, 21 Aug 2025 09:42:27 +0200 Subject: [PATCH] syntax: remove redundant semicolons after initializers --- json_parser/json_data.c2 | 6 +++--- json_parser/json_parser.c2 | 2 +- sudoku/sudoku.c2 | 16 ++++++++-------- toml_parser/toml_parser.c2 | 4 ++-- unit_test/mod1_test.c2 | 4 ++-- yaml_parser/yaml_iterator.c2 | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/json_parser/json_data.c2 b/json_parser/json_data.c2 index 6711c2e..14e1290 100644 --- a/json_parser/json_data.c2 +++ b/json_parser/json_data.c2 @@ -338,7 +338,7 @@ public fn const char* Iter.value(const Iter* i) { // Note: key == nil returns first child TODO public fn Iter Iter.get_child(const Iter* i, const char* key) { - Iter i2 = { i.data, 0 }; + Iter i2 = { i.data, 0 } if (i.cur_idx == 0) return i2; i2.cur_idx = find_nested_child(i.data, i.cur_idx, key); @@ -346,7 +346,7 @@ public fn Iter Iter.get_child(const Iter* i, const char* key) { } public fn Iter Iter.get_child_iter(const Iter* i) { - Iter iter = { i.data, 0 }; + Iter iter = { i.data, 0 } const Node* n = &i.data.nodes.data[i.cur_idx]; if (n.is_value()) return iter; iter.cur_idx = n.child_idx; @@ -429,7 +429,7 @@ fn bool Iter.check_schema_priv(const Iter* i, const char** schema) { if (!n.is_object()) return false; if ((*schema)[1] == '(') { *schema += 2; - Iter obj = { i.data, n.child_idx }; + Iter obj = { i.data, n.child_idx } if (!obj.check_schema_priv(schema)) return false; } break; diff --git a/json_parser/json_parser.c2 b/json_parser/json_parser.c2 index 5f7117f..5b159c3 100644 --- a/json_parser/json_parser.c2 +++ b/json_parser/json_parser.c2 @@ -29,7 +29,7 @@ public fn bool Parser.parse(Parser* p, const char* text) { } public fn Iter Parser.get_root(const Parser* p) { - Iter node = { p.data, 1 }; + Iter node = { p.data, 1 } return node; } diff --git a/sudoku/sudoku.c2 b/sudoku/sudoku.c2 index e96883e..bc9215c 100644 --- a/sudoku/sudoku.c2 +++ b/sudoku/sudoku.c2 @@ -203,8 +203,8 @@ fn void Board.checkFields(Board* board) { } fn void Board.checkRow(Board* board, u8 row) { - u8[10] count = { 0 }; - u8[10] pos = { 0 }; + u8[10] count = { 0 } + u8[10] pos = { 0 } for (u8 x=0; x<9; x++) { u32 idx = 9*row + x; const Field* f = &board.fields[idx]; @@ -223,8 +223,8 @@ fn void Board.checkRow(Board* board, u8 row) { } fn void Board.checkColumn(Board* board, u8 col) { - u8[10] count = { 0 }; - u8[10] pos = { 0 }; + u8[10] count = { 0 } + u8[10] pos = { 0 } for (u8 y=0; y<9; y++) { u32 idx = 9*y + col; const Field* f = &board.fields[idx]; @@ -246,10 +246,10 @@ fn bool Board.checkSquares(Board* board, bool extra) { for (u8 x=0; x<3; x++) { // check square u8 topleft = (y*9 + x) *3; - u8[10] count = { 0 }; - u8[10] pos = { 0 }; - u8[10] localRows = { 0 }; - u8[10] localCols = { 0 }; + u8[10] count = { 0 } + u8[10] pos = { 0 } + u8[10] localRows = { 0 } + u8[10] localCols = { 0 } const Field* f = &board.fields[topleft + 0]; for (u32 o=1; o<10; o++) { // TODO refactor with block below diff --git a/toml_parser/toml_parser.c2 b/toml_parser/toml_parser.c2 index 46ff0df..d228c79 100644 --- a/toml_parser/toml_parser.c2 +++ b/toml_parser/toml_parser.c2 @@ -526,7 +526,7 @@ public fn NodeIter Reader.getNodeIter(const Reader* r, const char* key) { if (node && getKind(node.nameOffset) == NodeKind.TableArray) { node = &r.blocks.nodes[node.child]; } - NodeIter iter = { r.blocks, node }; + NodeIter iter = { r.blocks, node } return iter; } @@ -537,7 +537,7 @@ public type ValueIter struct { } fn ValueIter ValueIter.create(const char* values, bool isArray) { - ValueIter iter = { values, isArray }; + ValueIter iter = { values, isArray } return iter; } diff --git a/unit_test/mod1_test.c2 b/unit_test/mod1_test.c2 index ad7fec8..94f17cc 100644 --- a/unit_test/mod1_test.c2 +++ b/unit_test/mod1_test.c2 @@ -38,8 +38,8 @@ fn void Test.test4(Test* t) @(skip) { */ fn void Test.test5(Test* t) { - u8[] a = { 0x1, 0x2, 0x3, 0x4 }; - u8[] b = { 0x1, 0x2, 0x8, 0x4 }; + u8[] a = { 0x1, 0x2, 0x3, 0x4 } + u8[] b = { 0x1, 0x2, 0x8, 0x4 } check_data(a, elemsof(a), b, elemsof(b)); } diff --git a/yaml_parser/yaml_iterator.c2 b/yaml_parser/yaml_iterator.c2 index 1b87537..091bc36 100644 --- a/yaml_parser/yaml_iterator.c2 +++ b/yaml_parser/yaml_iterator.c2 @@ -76,7 +76,7 @@ public type Iter struct { } public fn Iter Parser.getNodeChildIter(const Parser* p, const Node* n) { - Iter iter = { .data = &p.data, .node = nil }; + Iter iter = { .data = &p.data, .node = nil } if (n && n.kind != NodeKind.Scalar && n.child_idx) { iter.node = p.data.idx2node(n.child_idx); } @@ -108,7 +108,7 @@ public fn const char* Iter.getValue(const Iter* iter) { } public fn Iter Iter.getChildIter(Iter* parent) { - Iter iter = { .data = parent.data, .node = nil }; + Iter iter = { .data = parent.data, .node = nil } if (parent.node == nil) return iter; const Node* n = parent.node;