mirror of
https://github.com/NixOS/nix.git
synced 2025-11-22 02:09: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:
parent
09d6847490
commit
6d65f8eea2
1 changed files with 19 additions and 21 deletions
|
|
@ -170,8 +170,7 @@ struct curlFileTransfer : public FileTransfer
|
|||
|
||||
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 {
|
||||
size_t realSize = size * nmemb;
|
||||
result.bodySize += realSize;
|
||||
|
|
@ -194,7 +193,6 @@ struct curlFileTransfer : public FileTransfer
|
|||
writeException = std::current_exception();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static size_t writeCallbackWrapper(void * contents, size_t size, size_t nmemb, void * userp)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue