diff --git a/src/common/libflux/message.c b/src/common/libflux/message.c index 915a070c7fb3..160a3ca7a9e2 100644 --- a/src/common/libflux/message.c +++ b/src/common/libflux/message.c @@ -1050,7 +1050,7 @@ int flux_msg_vset_jsonf (flux_msg_t *msg, const char *fmt, va_list ap) return rc; } -int flux_msg_set_jsonf (flux_msg_t *msg, const char *fmt, ...) +int flux_msg_pack (flux_msg_t *msg, const char *fmt, ...) { va_list ap; int rc; diff --git a/src/common/libflux/message.h b/src/common/libflux/message.h index 5240c0311c6e..28ad0e583436 100644 --- a/src/common/libflux/message.h +++ b/src/common/libflux/message.h @@ -172,7 +172,7 @@ bool flux_msg_has_payload (const flux_msg_t *msg); * encoding/decoding the JSON object payload directly from/to its members. */ int flux_msg_set_json (flux_msg_t *msg, const char *json_str); -int flux_msg_set_jsonf (flux_msg_t *msg, const char *fmt, ...); +int flux_msg_pack (flux_msg_t *msg, const char *fmt, ...); int flux_msg_vset_jsonf (flux_msg_t *msg, const char *fmt, va_list ap); int flux_msg_get_json (const flux_msg_t *msg, const char **json_str); diff --git a/src/common/libflux/test/message.c b/src/common/libflux/test/message.c index d650f56bf8e1..e597c0312fe7 100644 --- a/src/common/libflux/test/message.c +++ b/src/common/libflux/test/message.c @@ -178,13 +178,13 @@ void check_payload_json_formatted (void) "flux_msg_get_jsonf fails with EPROTO with no payload"); errno = 0; - ok (flux_msg_set_jsonf (msg, "[i,i,i]", 1,2,3) < 0 && errno == EINVAL, - "flux_msg_set_jsonf array fails with EINVAL"); + ok (flux_msg_pack (msg, "[i,i,i]", 1,2,3) < 0 && errno == EINVAL, + "flux_msg_pack array fails with EINVAL"); errno = 0; - ok (flux_msg_set_jsonf (msg, "i", 3.14) < 0 && errno == EINVAL, - "flux_msg_set_jsonf scalar fails with EINVAL"); - ok (flux_msg_set_jsonf (msg, "{s:i, s:s}", "foo", 42, "bar", "baz") == 0, - "flux_msg_set_jsonf object works"); + ok (flux_msg_pack (msg, "i", 3.14) < 0 && errno == EINVAL, + "flux_msg_pack scalar fails with EINVAL"); + ok (flux_msg_pack (msg, "{s:i, s:s}", "foo", 42, "bar", "baz") == 0, + "flux_msg_pack object works"); i = 0; s = NULL; ok (flux_msg_get_jsonf (msg, "{s:i, s:s}", "foo", &i, "bar", &s) == 0, @@ -193,8 +193,8 @@ void check_payload_json_formatted (void) "decoded content matches encoded content"); /* reset payload */ - ok (flux_msg_set_jsonf (msg, "{s:i, s:s}", "foo", 43, "bar", "smurf") == 0, - "flux_msg_set_jsonf can replace JSON object payload"); + ok (flux_msg_pack (msg, "{s:i, s:s}", "foo", 43, "bar", "smurf") == 0, + "flux_msg_pack can replace JSON object payload"); i = 0; s = NULL; ok (flux_msg_get_jsonf (msg, "{s:i, s:s}", "foo", &i, "bar", &s) == 0,