mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-11-25 17:36:25 -05:00
Move everything to negative errno return types (#1499)
This commit is contained in:
parent
2b500f194a
commit
e8cd74cab0
177 changed files with 5952 additions and 5843 deletions
33
src/error.hpp
Normal file
33
src/error.hpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
|
||||
#include "errno.hpp"
|
||||
|
||||
#include <optional>
|
||||
|
||||
|
||||
struct Err
|
||||
{
|
||||
private:
|
||||
std::optional<int> _err;
|
||||
|
||||
public:
|
||||
Err()
|
||||
{
|
||||
}
|
||||
|
||||
operator int()
|
||||
{
|
||||
return (_err.has_value() ? _err.value() : -ENOENT);
|
||||
}
|
||||
|
||||
Err&
|
||||
operator=(int v_)
|
||||
{
|
||||
if(!_err.has_value())
|
||||
_err = v_;
|
||||
else if(v_ >= 0)
|
||||
_err = v_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue