Skip to content

Commit

Permalink
Merge READWRITEMANY into READWRITE
Browse files Browse the repository at this point in the history
Cherry-picked from: 2761bca
  • Loading branch information
sipa authored and xanimo committed Jul 6, 2024
1 parent 962b020 commit fb9f561
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 28 deletions.
28 changes: 1 addition & 27 deletions src/serialize.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,7 @@ enum
SER_GETHASH = (1 << 2),
};

#define READWRITE(obj) (::SerReadWrite(s, (obj), ser_action))
#define READWRITEMANY(...) (::SerReadWriteMany(s, ser_action, __VA_ARGS__))
#define READWRITE(...) (::SerReadWriteMany(s, ser_action, __VA_ARGS__))

/**
* Implement three methods for serializable objects. These are actually wrappers over
Expand Down Expand Up @@ -818,19 +817,6 @@ struct CSerActionUnserialize
constexpr bool ForRead() const { return true; }
};

template<typename Stream, typename T>
inline void SerReadWrite(Stream& s, const T& obj, CSerActionSerialize ser_action)
{
::Serialize(s, obj);
}

template<typename Stream, typename T>
inline void SerReadWrite(Stream& s, T& obj, CSerActionUnserialize ser_action)
{
::Unserialize(s, obj);
}





Expand Down Expand Up @@ -890,12 +876,6 @@ void SerializeMany(Stream& s)
{
}

template<typename Stream, typename Arg>
void SerializeMany(Stream& s, Arg&& arg)
{
::Serialize(s, std::forward<Arg>(arg));
}

template<typename Stream, typename Arg, typename... Args>
void SerializeMany(Stream& s, Arg&& arg, Args&&... args)
{
Expand All @@ -908,12 +888,6 @@ inline void UnserializeMany(Stream& s)
{
}

template<typename Stream, typename Arg>
inline void UnserializeMany(Stream& s, Arg& arg)
{
::Unserialize(s, arg);
}

template<typename Stream, typename Arg, typename... Args>
inline void UnserializeMany(Stream& s, Arg& arg, Args&... args)
{
Expand Down
2 changes: 1 addition & 1 deletion src/test/serialize_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class CSerializeMethodsTestMany : public CSerializeMethodsTestSingle

template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action) {
READWRITEMANY(intval, boolval, stringval, FLATDATA(charstrval), txval);
READWRITE(intval, boolval, stringval, FLATDATA(charstrval), txval);
}
};

Expand Down

0 comments on commit fb9f561

Please sign in to comment.