Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 62b9656

Browse files
committed
fix missing braces for for statements
1 parent 506f96f commit 62b9656

File tree

7 files changed

+36
-16
lines changed

7 files changed

+36
-16
lines changed

generated/dpll-user.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,18 +1117,21 @@ int dpll_pin_set(ynl_cpp::ynl_socket& ys, dpll_pin_set_req& req)
11171117
if (req.state.has_value()) {
11181118
ynl_attr_put_u32(nlh, DPLL_A_PIN_STATE, req.state.value());
11191119
}
1120-
for (unsigned int i = 0; i < req.parent_device.size(); i++)
1120+
for (unsigned int i = 0; i < req.parent_device.size(); i++) {
11211121
dpll_pin_parent_device_put(nlh, DPLL_A_PIN_PARENT_DEVICE, req.parent_device[i]);
1122-
for (unsigned int i = 0; i < req.parent_pin.size(); i++)
1122+
}
1123+
for (unsigned int i = 0; i < req.parent_pin.size(); i++) {
11231124
dpll_pin_parent_pin_put(nlh, DPLL_A_PIN_PARENT_PIN, req.parent_pin[i]);
1125+
}
11241126
if (req.phase_adjust.has_value()) {
11251127
ynl_attr_put_s32(nlh, DPLL_A_PIN_PHASE_ADJUST, req.phase_adjust.value());
11261128
}
11271129
if (req.esync_frequency.has_value()) {
11281130
ynl_attr_put_u64(nlh, DPLL_A_PIN_ESYNC_FREQUENCY, req.esync_frequency.value());
11291131
}
1130-
for (unsigned int i = 0; i < req.reference_sync.size(); i++)
1132+
for (unsigned int i = 0; i < req.reference_sync.size(); i++) {
11311133
dpll_reference_sync_put(nlh, DPLL_A_PIN_REFERENCE_SYNC, req.reference_sync[i]);
1134+
}
11321135

11331136
err = ynl_exec(ys, nlh, &yrs);
11341137
if (err < 0) {

generated/ethtool-user.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2492,8 +2492,9 @@ int ethtool_profile_put(struct nlmsghdr *nlh, unsigned int attr_type,
24922492
struct nlattr *nest;
24932493

24942494
nest = ynl_attr_nest_start(nlh, attr_type);
2495-
for (unsigned int i = 0; i < obj.irq_moderation.size(); i++)
2495+
for (unsigned int i = 0; i < obj.irq_moderation.size(); i++) {
24962496
ethtool_irq_moderation_put(nlh, ETHTOOL_A_PROFILE_IRQ_MODERATION, obj.irq_moderation[i]);
2497+
}
24972498
ynl_attr_nest_end(nlh, nest);
24982499

24992500
return 0;
@@ -2652,8 +2653,9 @@ int ethtool_bitset_bits_put(struct nlmsghdr *nlh, unsigned int attr_type,
26522653
struct nlattr *nest;
26532654

26542655
nest = ynl_attr_nest_start(nlh, attr_type);
2655-
for (unsigned int i = 0; i < obj.bit.size(); i++)
2656+
for (unsigned int i = 0; i < obj.bit.size(); i++) {
26562657
ethtool_bitset_bit_put(nlh, ETHTOOL_A_BITSET_BITS_BIT, obj.bit[i]);
2658+
}
26572659
ynl_attr_nest_end(nlh, nest);
26582660

26592661
return 0;
@@ -2706,8 +2708,9 @@ int ethtool_strings_put(struct nlmsghdr *nlh, unsigned int attr_type,
27062708
struct nlattr *nest;
27072709

27082710
nest = ynl_attr_nest_start(nlh, attr_type);
2709-
for (unsigned int i = 0; i < obj.string.size(); i++)
2711+
for (unsigned int i = 0; i < obj.string.size(); i++) {
27102712
ethtool_string_put(nlh, ETHTOOL_A_STRINGS_STRING, obj.string[i]);
2713+
}
27112714
ynl_attr_nest_end(nlh, nest);
27122715

27132716
return 0;
@@ -2843,8 +2846,9 @@ int ethtool_stringset_put(struct nlmsghdr *nlh, unsigned int attr_type,
28432846
if (obj.count.has_value()) {
28442847
ynl_attr_put_u32(nlh, ETHTOOL_A_STRINGSET_COUNT, obj.count.value());
28452848
}
2846-
for (unsigned int i = 0; i < obj.strings.size(); i++)
2849+
for (unsigned int i = 0; i < obj.strings.size(); i++) {
28472850
ethtool_strings_put(nlh, ETHTOOL_A_STRINGSET_STRINGS, obj.strings[i]);
2851+
}
28482852
ynl_attr_nest_end(nlh, nest);
28492853

28502854
return 0;
@@ -2963,8 +2967,9 @@ int ethtool_stringsets_put(struct nlmsghdr *nlh, unsigned int attr_type,
29632967
struct nlattr *nest;
29642968

29652969
nest = ynl_attr_nest_start(nlh, attr_type);
2966-
for (unsigned int i = 0; i < obj.stringset.size(); i++)
2970+
for (unsigned int i = 0; i < obj.stringset.size(); i++) {
29672971
ethtool_stringset_put(nlh, ETHTOOL_A_STRINGSETS_STRINGSET, obj.stringset[i]);
2972+
}
29682973
ynl_attr_nest_end(nlh, nest);
29692974

29702975
return 0;

generated/handshake-user.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,9 @@ int handshake_done(ynl_cpp::ynl_socket& ys, handshake_done_req& req)
302302
if (req.sockfd.has_value()) {
303303
ynl_attr_put_s32(nlh, HANDSHAKE_A_DONE_SOCKFD, req.sockfd.value());
304304
}
305-
for (unsigned int i = 0; i < req.remote_auth.size(); i++)
305+
for (unsigned int i = 0; i < req.remote_auth.size(); i++) {
306306
ynl_attr_put_u32(nlh, HANDSHAKE_A_DONE_REMOTE_AUTH, req.remote_auth[i]);
307+
}
307308

308309
err = ynl_exec(ys, nlh, &yrs);
309310
if (err < 0) {

generated/net_shaper-user.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,8 +506,9 @@ net_shaper_group(ynl_cpp::ynl_socket& ys, net_shaper_group_req& req)
506506
if (req.weight.has_value()) {
507507
ynl_attr_put_u32(nlh, NET_SHAPER_A_WEIGHT, req.weight.value());
508508
}
509-
for (unsigned int i = 0; i < req.leaves.size(); i++)
509+
for (unsigned int i = 0; i < req.leaves.size(); i++) {
510510
net_shaper_leaf_info_put(nlh, NET_SHAPER_A_LEAVES, req.leaves[i]);
511+
}
511512

512513
rsp.reset(new net_shaper_group_rsp());
513514
yrs.yarg.data = rsp.get();

generated/netdev-user.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,9 @@ netdev_bind_rx(ynl_cpp::ynl_socket& ys, netdev_bind_rx_req& req)
12491249
if (req.fd.has_value()) {
12501250
ynl_attr_put_u32(nlh, NETDEV_A_DMABUF_FD, req.fd.value());
12511251
}
1252-
for (unsigned int i = 0; i < req.queues.size(); i++)
1252+
for (unsigned int i = 0; i < req.queues.size(); i++) {
12531253
netdev_queue_id_put(nlh, NETDEV_A_DMABUF_QUEUES, req.queues[i]);
1254+
}
12541255

12551256
rsp.reset(new netdev_bind_rx_rsp());
12561257
yrs.yarg.data = rsp.get();

generated/nfsd-user.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,9 @@ int nfsd_threads_set(ynl_cpp::ynl_socket& ys, nfsd_threads_set_req& req)
393393
nlh = ynl_gemsg_start_req(ys, ((struct ynl_sock*)ys)->family_id, NFSD_CMD_THREADS_SET, 1);
394394
((struct ynl_sock*)ys)->req_policy = &nfsd_server_nest;
395395

396-
for (unsigned int i = 0; i < req.threads.size(); i++)
396+
for (unsigned int i = 0; i < req.threads.size(); i++) {
397397
ynl_attr_put_u32(nlh, NFSD_A_SERVER_THREADS, req.threads[i]);
398+
}
398399
if (req.gracetime.has_value()) {
399400
ynl_attr_put_u32(nlh, NFSD_A_SERVER_GRACETIME, req.gracetime.value());
400401
}
@@ -501,8 +502,9 @@ int nfsd_version_set(ynl_cpp::ynl_socket& ys, nfsd_version_set_req& req)
501502
nlh = ynl_gemsg_start_req(ys, ((struct ynl_sock*)ys)->family_id, NFSD_CMD_VERSION_SET, 1);
502503
((struct ynl_sock*)ys)->req_policy = &nfsd_server_proto_nest;
503504

504-
for (unsigned int i = 0; i < req.version.size(); i++)
505+
for (unsigned int i = 0; i < req.version.size(); i++) {
505506
nfsd_version_put(nlh, NFSD_A_SERVER_PROTO_VERSION, req.version[i]);
507+
}
506508

507509
err = ynl_exec(ys, nlh, &yrs);
508510
if (err < 0) {
@@ -591,8 +593,9 @@ int nfsd_listener_set(ynl_cpp::ynl_socket& ys, nfsd_listener_set_req& req)
591593
nlh = ynl_gemsg_start_req(ys, ((struct ynl_sock*)ys)->family_id, NFSD_CMD_LISTENER_SET, 1);
592594
((struct ynl_sock*)ys)->req_policy = &nfsd_server_sock_nest;
593595

594-
for (unsigned int i = 0; i < req.addr.size(); i++)
596+
for (unsigned int i = 0; i < req.addr.size(); i++) {
595597
nfsd_sock_put(nlh, NFSD_A_SERVER_SOCK_ADDR, req.addr[i]);
598+
}
596599

597600
err = ynl_exec(ys, nlh, &yrs);
598601
if (err < 0) {

ynl-gen-cpp.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,18 +649,24 @@ def _attr_get(self, ri, var):
649649
def attr_put(self, ri, var):
650650
if self.attr["type"] in scalars:
651651
put_type = self.type
652-
ri.cw.p(f"for (unsigned int i = 0; i < {var}.{self.c_name}.size(); i++)")
652+
ri.cw.block_start(
653+
line=f"for (unsigned int i = 0; i < {var}.{self.c_name}.size(); i++)"
654+
)
653655
ri.cw.p(
654656
f"ynl_attr_put_{put_type}(nlh, {self.enum_name}, {var}.{self.c_name}[i]);"
655657
)
658+
ri.cw.block_end()
656659
elif "type" not in self.attr or self.attr["type"] == "nest":
657-
ri.cw.p(f"for (unsigned int i = 0; i < {var}.{self.c_name}.size(); i++)")
660+
ri.cw.block_start(
661+
line=f"for (unsigned int i = 0; i < {var}.{self.c_name}.size(); i++)"
662+
)
658663
self._attr_put_line(
659664
ri,
660665
var,
661666
f"{self.nested_render_name}_put(nlh, "
662667
+ f"{self.enum_name}, {var}.{self.c_name}[i])",
663668
)
669+
ri.cw.block_end()
664670
else:
665671
raise Exception(
666672
f"Put of MultiAttr sub-type {self.attr['type']} not supported yet"

0 commit comments

Comments
 (0)