1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-22 10:19:36 +01:00

libstore: Slightly deindent writeCallback by wrapping it in try/catch

The indentation level of the code is already high enough. We can just
wrap the whole function in a try/catch and mark it noexcept.

Partially cherry-picked from https://gerrit.lix.systems/c/lix/+/2133

Co-authored-by: eldritch horrors <pennae@lix.systems>
This commit is contained in:
Sergei Zimmerman 2025-11-19 01:30:02 +03:00
parent 09d6847490
commit 6d65f8eea2
No known key found for this signature in database

View file

@ -170,8 +170,7 @@ struct curlFileTransfer : public FileTransfer
std::exception_ptr writeException; std::exception_ptr writeException;
size_t writeCallback(void * contents, size_t size, size_t nmemb) size_t writeCallback(void * contents, size_t size, size_t nmemb) noexcept
{
try { try {
size_t realSize = size * nmemb; size_t realSize = size * nmemb;
result.bodySize += realSize; result.bodySize += realSize;
@ -194,7 +193,6 @@ struct curlFileTransfer : public FileTransfer
writeException = std::current_exception(); writeException = std::current_exception();
return 0; return 0;
} }
}
static size_t writeCallbackWrapper(void * contents, size_t size, size_t nmemb, void * userp) static size_t writeCallbackWrapper(void * contents, size_t size, size_t nmemb, void * userp)
{ {