Skip to content

Commit

Permalink
content: correct message unpack style
Browse files Browse the repository at this point in the history
Problem:  The typical message unpack style is to place key names
and storage pointers on the same line, but that is not done in
several locations in the content and content backing modules.

Correct code style to be more consistent to the rest of flux-core.
  • Loading branch information
chu11 committed Sep 3, 2024
1 parent f94d669 commit 3f4fbd4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 30 deletions.
9 changes: 3 additions & 6 deletions src/modules/content-files/content-files.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ void checkpoint_get_cb (flux_t *h,
if (flux_respond_pack (h,
msg,
"{s:O}",
"value",
o) < 0)
"value", o) < 0)
flux_log_error (h, "error responding to checkpoint-get request");
free (data);
json_decref (o);
Expand Down Expand Up @@ -257,10 +256,8 @@ void checkpoint_put_cb (flux_t *h,
if (flux_request_unpack (msg,
NULL,
"{s:s s:o}",
"key",
&key,
"value",
&o) < 0)
"key", &key,
"value", &o) < 0)
goto error;
if (!(value = json_dumps (o, JSON_COMPACT))) {
errstr = "failed to encode checkpoint value";
Expand Down
21 changes: 7 additions & 14 deletions src/modules/content-s3/content-s3.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,10 @@ static struct s3_config *parse_config (const flux_conf_t *conf,
&error,
"{s:{s:s, s:s, s:s, s?b !} }",
"content-s3",
"credential-file",
&cred_file,
"bucket",
&bucket,
"uri",
&uri,
"virtual-host-style",
&is_virtual_host) < 0) {
"credential-file", &cred_file,
"bucket", &bucket,
"uri", &uri,
"virtual-host-style", &is_virtual_host) < 0) {
errprintf (errp, "%s", error.text);
goto error;
}
Expand Down Expand Up @@ -367,8 +363,7 @@ void checkpoint_get_cb (flux_t *h,
if (flux_respond_pack (h,
msg,
"{s:O}",
"value",
o) < 0) {
"value", o) < 0) {
errno = EIO;
flux_log_error (h, "error responding to checkpoint-get request (pack)");
}
Expand Down Expand Up @@ -400,10 +395,8 @@ void checkpoint_put_cb (flux_t *h,
if (flux_request_unpack (msg,
NULL,
"{s:s s:o}",
"key",
&key,
"value",
&o) < 0)
"key", &key,
"value", &o) < 0)
goto error;
if (!(value = json_dumps (o, JSON_COMPACT))) {
errstr = "failed to encode checkpoint value";
Expand Down
9 changes: 3 additions & 6 deletions src/modules/content-sqlite/content-sqlite.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@ void checkpoint_get_cb (flux_t *h,
if (flux_respond_pack (h,
msg,
"{s:O}",
"value",
o) < 0)
"value", o) < 0)
flux_log_error (h, "flux_respond_pack");
(void )sqlite3_reset (ctx->checkpt_get_stmt);
json_decref (o);
Expand All @@ -440,10 +439,8 @@ void checkpoint_put_cb (flux_t *h,
if (flux_request_unpack (msg,
NULL,
"{s:s s:o}",
"key",
&key,
"value",
&o) < 0)
"key", &key,
"value", &o) < 0)
goto error;
if (!(value = json_dumps (o, JSON_COMPACT))) {
errstr = "failed to encode checkpoint value";
Expand Down
6 changes: 2 additions & 4 deletions src/modules/content/checkpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,8 @@ void content_checkpoint_put_request (flux_t *h, flux_msg_handler_t *mh,
if (flux_request_unpack (msg,
NULL,
"{s:s s:o}",
"key",
&key,
"value",
&value) < 0)
"key", &key,
"value", &value) < 0)
goto error;

if (checkpoint->rank == 0) {
Expand Down

0 comments on commit 3f4fbd4

Please sign in to comment.