diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-03-23 17:14:33 +0900 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-03-23 17:14:33 +0900 |
commit | de1fc577666686fb0c3f8b38d8c6c90eb6dff414 (patch) | |
tree | 9694f6d4965f803075fb74b9dfa242fe73ec66ab | |
parent | bb39a8b223f78205a10ffcb61e3b3bfe05b3fd1a (diff) |
Update sendReply(): accepting LLSD by value already copies it.
-rw-r--r-- | indra/llcommon/llevents.cpp | 13 | ||||
-rw-r--r-- | indra/llcommon/llevents.h | 2 |
2 files changed, 6 insertions, 9 deletions
diff --git a/indra/llcommon/llevents.cpp b/indra/llcommon/llevents.cpp index 01bba7a620..667e047fd3 100644 --- a/indra/llcommon/llevents.cpp +++ b/indra/llcommon/llevents.cpp @@ -726,7 +726,7 @@ void LLReqID::stamp(LLSD& response) const response["reqid"] = mReqid; } -bool sendReply(const LLSD& reply, const LLSD& request, const std::string& replyKey) +bool sendReply(LLSD reply, const LLSD& request, const std::string& replyKey) { // If the original request has no value for replyKey, it's pointless to // construct or send a reply event: on which LLEventPump should we send @@ -739,13 +739,10 @@ bool sendReply(const LLSD& reply, const LLSD& request, const std::string& replyK // Here the request definitely contains replyKey; reasonable to proceed. - // Copy 'reply' to modify it. - LLSD newreply(reply); // Get the ["reqid"] element from request LLReqID reqID(request); - // and copy it to 'newreply'. - reqID.stamp(newreply); - // Send reply on LLEventPump named in request[replyKey]. Don't forget to - // send the modified 'newreply' instead of the original 'reply'. - return LLEventPumps::instance().obtain(request[replyKey]).post(newreply); + // and copy it to 'reply'. + reqID.stamp(reply); + // Send reply on LLEventPump named in request[replyKey]. + return LLEventPumps::instance().obtain(request[replyKey]).post(reply); } diff --git a/indra/llcommon/llevents.h b/indra/llcommon/llevents.h index c1dbf4392f..1f35a6de18 100644 --- a/indra/llcommon/llevents.h +++ b/indra/llcommon/llevents.h @@ -779,7 +779,7 @@ private: * Before sending the reply event, sendReply() copies the ["reqid"] item from * the request to the reply. */ -LL_COMMON_API bool sendReply(const LLSD& reply, const LLSD& request, +LL_COMMON_API bool sendReply(LLSD reply, const LLSD& request, const std::string& replyKey="reply"); #endif /* ! defined(LL_LLEVENTS_H) */ |