Skip to content

Commit

Permalink
tools: use initialization rather than assignment to construct seriali…
Browse files Browse the repository at this point in the history
…ze descriptors
  • Loading branch information
jengelh committed Sep 22, 2023
1 parent 95763a8 commit 23d5954
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 18 deletions.
11 changes: 3 additions & 8 deletions exch/exmdb_provider/exmdb_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,10 @@ BOOL exmdb_client_relay_delivery(const char *dir, const char *from_address,
exmdb_server::set_dir(original_dir);
return b_result;
}
exreq_deliver_message q{};
exreq_deliver_message q{exmdb_callid::deliver_message, deconst(dir),
deconst(from_address), deconst(account), cpid, 0,
deconst(pmsg), deconst(pdigest)};
exresp_deliver_message r{};
q.call_id = exmdb_callid::deliver_message;
q.dir = deconst(dir);
q.from_address = deconst(from_address);
q.account = deconst(account);
q.cpid = cpid;
q.pmsg = deconst(pmsg);
q.pdigest = deconst(pdigest);
if (!exmdb_client_do_rpc(&q, &r))
return FALSE;
*presult = r.result;
Expand Down
10 changes: 4 additions & 6 deletions tools/exmidl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,16 @@
}

print "BOOL exmdb_client_remote::$func($rbsig)\n{\n";
print "\texreq_$func q{};\n\texresp_$func r{};\n";
print "\n";
print "\tq.call_id = exmdb_callid::$func;\n";
print "\tq.dir = deconst(dir);\n";
print "\texreq_$func q{exmdb_callid::$func, deconst(dir)";
for (@$iargs) {
my($type, $field) = @$_;
if (substr($type, -1, 1) eq "*") {
print "\tq.$field = deconst($field);\n";
print ", deconst($field)";
} else {
print "\tq.$field = $field;\n";
print ", $field";
}
}
print "};\n\texresp_$func r{};\n";
print "\tif (!exmdb_client_do_rpc(&q, &r))\n\t\treturn false;\n";
for (@$oargs) {
my($type, $field) = @$_;
Expand Down
8 changes: 4 additions & 4 deletions tools/zcidl.pl
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@
}

print "uint32_t zclient_$func($rbsig)\n{\n";
print "\tzcreq_$func q{};\n\tzcresp_$func r{};\n\n";
print "\tq.call_id = zcore_callid::$func;\n";
print "\tzcreq_$func q{zcore_callid::$func";
for (@$iargs) {
my($type, $field) = @$_;
if (substr($type, -1, 1) eq "*") {
print "\tq.$field = deconst($field);\n";
print ", deconst($field)";
} else {
print "\tq.$field = $field;\n";
print ", $field";
}
}
print "};\n\tzcresp_$func r{};\n\n";
print "\tif (!zclient_do_rpc(&q, &r))\n\t\treturn ecRpcFailed;\n";
if (scalar(@$oargs) > 0) {
print "\tif (r.result != ecSuccess)\n\t\treturn r.result;\n";
Expand Down

0 comments on commit 23d5954

Please sign in to comment.